code: def test_categorical_columns(connection):
      vf.runtime.set_connection(connection)
  
      df = pd.DataFrame(
          {
              "a": [0, 1, 2, 3, 4, 5],
              "categorical": pd.Categorical.from_codes(
                  [0, 1, 0, 1, 1, 0], ["A", "BB"]
              ),
          }
      )
  
      chart = (
          alt.Chart(df)
          .mark_bar()
          .encode(alt.X("categorical:N"), alt.Y("sum(a):Q"))
      )
      transformed = vf.transformed_data(chart)
      expected = pd.DataFrame(
          {"categorical": ["A", "BB"], "sum_a": [7, 8]}
      )
      pd.testing.assert_frame_equal(transformed, expected)
  
file_path: vegafusion/python/vegafusion/tests/test_transformed_data.py
imports: from pathlib import Path
  import pandas
  import pyarrow
  import pytest
  from altair.utils.execeval import eval_block
  import vegafusion
  from vega_datasets import data
  import polars
  import altair
label_desc: Use image node_id 6 for calling a global function with example usage: test_categorical_columns(connection) without return types