code: def _do_convert_categoricals(self, data, value_label_dict, lbllist,
                                   order_categoricals):
          
          value_labels = list(value_label_dict.keys())
          cat_converted_data = []
          for col, label in zip(data, lbllist):
              if label in value_labels:
                  # Explicit call with ordered=True
                  cat_data = Categorical(data[col], ordered=order_categoricals)
                  categories = []
                  for category in cat_data.categories:
                      if category in value_label_dict[label]:
                          categories.append(value_label_dict[label][category])
                      else:
                          categories.append(category)  # Partially labeled
                  try:
                      cat_data.categories = categories
                  except ValueError:
                      vc = Series(categories).value_counts()
                      repeats = list(vc.index[vc > 1])
                      repeats = '-' * 80 + '\n' + '\n'.join(repeats)
                      # GH 25772
                      msg = """
  Value labels for column {col} are not unique. These cannot be converted to
  pandas categoricals.
  
  Either read the file with `convert_categoricals` set to False or use the
  low level interface in `StataReader` to separately read the values and the
  value_labels.
  
  The repeated labels are:
  {repeats}
  """
                      raise ValueError(msg.format(col=col, repeats=repeats))
                  # TODO: is the next line needed above in the data(...) method?
                  cat_data = Series(cat_data, index=data.index)
                  cat_converted_data.append((col, cat_data))
              else:
                  cat_converted_data.append((col, data[col]))
          data = DataFrame.from_dict(OrderedDict(cat_converted_data))
          return data
docs: Converts categorical columns to Categorical type.