Xorbits' DataFrame sort_index is inconsistent with pandas when axis=1 and ignore_index=True.
pandas does it by sorting the index as usual and replacing index (when axis=0) or columns (when axis=1) with RangeIndex.
Here is the reference code.
So here we follow pandas and replace index or columns when ignore_index=True is passed.
In the latest version, during the map phase of DataFrameGroupbySortShuffle, if in_df does not contain the index from pivots, an empty out_df is returned.
What do these changes do?
sort_index
Xorbits' DataFrame
sort_index
is inconsistent with pandas whenaxis=1
andignore_index=True
. pandas does it by sorting the index as usual and replacing index (when axis=0) or columns (when axis=1) with RangeIndex. Here is the reference code.So here we follow pandas and replace index or columns when
ignore_index=True
is passed.groupby(sort=True).agg()
python/xorbits/_mars/dataframe/groupby/sort.py
:In the latest version, during the map phase of DataFrameGroupbySortShuffle, if
in_df
does not contain the index from pivots, an emptyout_df
is returned.Related issue number
Check code requirements