code: def _encode_categorical_series(series, allow_drop=True):
      values = _get_dummies_1d(series, allow_drop=allow_drop)
      if values is None:
          return
  
      enc, levels = values
      if enc is None:
          return pd.Series(
              index=series.index, name=series.name, dtype=series.dtype
          )
  
      if not allow_drop and enc.shape[1] == 1:
          return series
  
      names = []
      for key in range(1, enc.shape[1]):
          names.append(f"{series.name}={levels[key]}")
      series = pd.DataFrame(
          enc[:, 1:], columns=names, index=series.index
      )
  
      return series
  
file_path: scikit-survival/sksurv/column.py
imports: import logging
  import numpy
  import pandas
  from pandas.api.types import CategoricalDtype, is_object_dtype
label_desc: Use image node_id 4 for calling a global function with example usage: _encode_categorical_series(series, allow_drop) and returns: series, pd, series