Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
## Caveat: (1) less flexible regarding assigning new values
dairy_table['Food_Category'] = dairy_table['Food_Category'].astype('category')
dairy_table['Food_Category'].iloc[2] = 'Another_Category'
In [112]: ValueError: Cannot setitem on a Categorical with a new category, set the categories first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment