code: def series2cat(df:DataFrame, *col_names):
      "Categorifies the columns `col_names` in `df`."
      for c in listify(col_names): df[c] = df[c].astype('category').cat.as_ordered(f series2cat(df:DataFrame, *col_names):
      "Categorifies the columns `col_names` in `df`."
      for c in listify(col_names): df[c] = df[c].astype('category').cat.as_ordered()
docs: Categorifies the columns `col_names` in `df`.