Last active
September 9, 2020 03:12
-
-
Save YiLi225/b5fd23fd3ebea8d20b380fffdd62c57e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Correct way to set new category values ## | |
dairy_table['Food_Category'] = dairy_table['Food_Category'].cat.add_categories(['Another_Category']) | |
dairy_table['Food_Category'].iloc[2] = 'Another_Category' | |
Out[116]: | |
index0 Milk | |
index1 others | |
index2 Another_Category | |
index3 Milk | |
index4 Milk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment