def _do_convert_categoricals(self, data, value_label_dict, lbllist,<EOL>order_categoricals):
value_labels = list(value_label_dict.keys())<EOL>cat_converted_data = []<EOL>for col, label in zip(data, lbllist):<EOL><INDENT>if label in value_labels:<EOL><INDENT>cat_data = Categorical(data[col], ordered=order_categoricals)<EOL>categories = []<EOL>for category in cat_data.categories:<EOL><INDENT>if category in value_label_dict[label]:<EOL><INDENT>categories.append(value_label_dict[label][category])<EOL><DEDENT>else:<EOL><INDENT>categories.append(category)  <EOL><DEDENT><DEDENT>try:<EOL><INDENT>cat_data.categories = categories<EOL><DEDENT>except ValueError:<EOL><INDENT>vc = Series(categories).value_counts()<EOL>repeats = list(vc.index[vc > <NUM_LIT:1>])<EOL>repeats = '<STR_LIT:->' * <NUM_LIT> + '<STR_LIT:\n>' + '<STR_LIT:\n>'.join(repeats)<EOL>msg =
Converts categorical columns to Categorical type.