Get a list of categories of categorical variable (Python Pandas)
df.column name.value_counts() # to see total number of values for each categories in a column
df.column name.value_counts().index # to see only the categories name
df.column name .value_counts().count() # to see how many categories in a column (only number)
I have a pandas DataFrame with a column representing a categorical variable. How can I get a list of the categories? I tried .values on the column but that does not return the unique levels.
Thanks!