describe categorical data pandas code example
Example 1: treat NaN as a category
g_without_nan = g.cat.add_categories("D").fillna("D")
Example 2: how to store categorical variables in separate dataframe
df.loc[:,df.dtypes==np.object]
g_without_nan = g.cat.add_categories("D").fillna("D")
df.loc[:,df.dtypes==np.object]