code: def test_unknown_categoricals(
      shuffle_method, numeric_only, npartitions, split_out, request
  ):
      dsk = {("unknown", i): df for (i, df) in enumerate(frames)}
      meta = {
          "v": "object",
          "w": "category",
          "x": "i8",
          "y": "category",
          "z": "f8",
      }
      if not dd._dask_expr_enabled():
          ddf = dd.DataFrame(
              dsk,
              "unknown",
              make_meta(
                  meta,
                  parent_meta=frames[0],
              ),
              [None] * 4,
          )
      else:
          ddf = dd.from_pandas(
              pd.concat(dsk.values()).astype(meta), npartitions=4
          )
      if npartitions == 10 and not PANDAS_GE_150:
          request.applymarker(
              pytest.mark.xfail(reason="group_keys not supported")
          )
      if npartitions is not None:
          ddf = ddf.repartition(npartitions=npartitions)
      # Compute
      df = ddf.compute()
  
      assert_eq(ddf.w.value_counts(), df.w.value_counts())
      assert_eq(ddf.w.nunique(), df.w.nunique())
  
      ctx = (
          pytest.warns(
              FutureWarning, match="The default of observed=False"
          )
          if PANDAS_GE_210
          else contextlib.nullcontext()
      )
      numeric_kwargs = (
          {} if numeric_only is None else {"numeric_only": numeric_only}
      )
      with ctx:
          expected = df.groupby(df.w).sum(**numeric_kwargs)
      with ctx:
          result = ddf.groupby(ddf.w).sum(**numeric_kwargs)
      assert_eq(result, expected)
  
      with ctx:
          expected = df.groupby(df.w).y.nunique()
      with ctx:
          result = ddf.groupby(ddf.w, sort=False).y.nunique(
              split_out=split_out
          )
      assert_eq(result, expected)
  
      with ctx:
          expected = df.y.groupby(df.w).count()
      with ctx:
          result = ddf.y.groupby(ddf.w).count()
      assert_eq(result, expected)
  
imports: from __future__ import annotations
  import contextlib
  import operator
  import warnings
  import numpy
  import pandas
  import pytest
  import dask
  import dask.dataframe
  from dask.dataframe import _compat
  from dask.dataframe._compat import PANDAS_GE_150, PANDAS_GE_200, PANDAS_GE_210, tm
  from dask.dataframe._pyarrow import to_pyarrow_string
  from dask.dataframe.core import _concat
  from dask.dataframe.utils import assert_eq, clear_known_categories, get_string_dtype, make_meta, pyarrow_strings_enabled
label_desc: Use image node_id 2 for calling a global function with example usage: test_unknown_categoricals(shuffle_method, numeric_only, npartitions, split_out, request) without return types