code: def test_func_aggregator_categorical_time_data(cat_series):
      # TIME indexed data -> resampled output should be same size as n_out
      cat_series.index = pd.date_range(
          "1/1/2020", periods=len(cat_series), freq="1s"
      )
  
      def cat_count(x):
          return len(np.unique(x))
  
      for n in np.random.randint(100, len(cat_series), 3):
          agg_x, agg_y = FuncAggregator(
              aggregation_func=cat_count
          ).aggregate(
              cat_series.index.values, cat_series.values.codes, n_out=n
          )
          assert not np.isnan(agg_y).any()
          assert len(agg_x) <= n + 1
  
imports: import numpy
  import pandas
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from plotly_resampler.aggregation import LTTB, EveryNthPoint, FuncAggregator, MedDiffGapHandler, MinMaxAggregator, MinMaxLTTB, MinMaxOverlapAggregator, NoGapHandler
  from .utils import construct_index, wrap_aggregate
label_desc: Use image node_id 11 for calling a global function with example usage: test_func_aggregator_categorical_time_data(cat_series) and returns: len