code: def _set_pattern_columns(self, path_column):
          
          try:
              # CategoricalDtype allows specifying known categories when
              # creating objects. It was added in pandas 0.21.0.
              from pandas.api.types import CategoricalDtype
              _HAS_CDT = True
          except ImportError:
              _HAS_CDT = False
  
          col = self._dataframe[path_column]
          paths = col.cat.categories
  
          column_by_field = {field:
              col.cat.codes.map(dict(enumerate(values))).astype(
                  "category" if not _HAS_CDT else CategoricalDtype(set(values))
              ) for field, values in reverse_formats(self.pattern, paths).items()
          }
          self._dataframe = self._dataframe.assign(**column_by_field)
docs: Get a column of values for each field in pattern