When #7217 becomes available, it would be nice to also have a 'CategoricalIndex' so that the sorting behaviour based on levels will be preserved when a categorical becomes a index:
cats = pd.Categorical([1,2,3,4], levels=[4,2,3,1]) strings = ["a","b","c","d"] values = [4,2,3,1] df = pd.DataFrame({"strings":strings, "values":values}, index=cats) df.index # This should sort by levels but does not as there is no CategoricalIndex! df.sort_index()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4