5 Best Ways to Add New Categories to Pandas CategoricalIndex
Expanding Pandas’ CategoricalIndex: How to Add New Categories π‘ Problem Formulation: When working with pandas’ CategoricalIndex, we often encounter situations where we need to expand the index with additional categories. Consider having a pandas DataFrame with a categorical index ‘grade’ that has categories [‘A’, ‘B’, ‘C’]. What if we want to add a ‘D’ grade … Read more