code: def describe_nonnumeric_aggregate(stats, name):
      args_len = len(stats)
  
      is_datetime_column = args_len == 5
      is_categorical_column = args_len == 3
  
      assert is_datetime_column or is_categorical_column
  
      if is_categorical_column:
          nunique, count, top_freq = stats
      else:
          nunique, count, top_freq, min_ts, max_ts = stats
  
      # input was empty dataframe/series
      if len(top_freq) == 0:
          data = [0, 0]
          index = ["count", "unique"]
          dtype = None
          data.extend([np.nan, np.nan])
          index.extend(["top", "freq"])
          dtype = object
          result = pd.Series(data, index=index, dtype=dtype, name=name)
          return result
  
      top = top_freq.index[0]
      freq = top_freq.iloc[0]
  
      index = ["unique", "count", "top", "freq"]
      values = [nunique, count]
  
      if is_datetime_column:
          tz = top.tz
          top = pd.Timestamp(top)
          if top.tzinfo is not None and tz is not None:
              # Don't tz_localize(None) if key is already tz-aware
              top = top.tz_convert(tz)
          else:
              top = top.tz_localize(tz)
  
          first = pd.Timestamp(min_ts, tz=tz)
          last = pd.Timestamp(max_ts, tz=tz)
          index.extend(["first", "last"])
          values.extend([top, freq, first, last])
      else:
          values.extend([top, freq])
  
      return pd.Series(values, index=index, name=name)
  
imports: from __future__ import annotations
  import warnings
  from functools import partial
  import numpy
  import pandas
  from pandas.api.types import is_extension_array_dtype
  from pandas.errors import PerformanceWarning
  from tlz import partition
  from dask.dataframe._compat import PANDAS_GE_131, PANDAS_GE_140, PANDAS_GE_200, check_apply_dataframe_deprecation, check_applymap_dataframe_deprecation, check_convert_dtype_deprecation, check_observed_deprecation
  from dask.dataframe.dispatch import concat, concat_dispatch, group_split_dispatch, hash_object_dispatch, is_categorical_dtype, is_categorical_dtype_dispatch, tolist, tolist_dispatch, union_categoricals
  from dask.dataframe.utils import is_dataframe_like, is_index_like, is_series_like
label_desc: Use image node_id 15 for calling a global function with example usage: describe_nonnumeric_aggregate(stats, name) and returns: pd, result