df.sort_values() not respecting na_position with categoricals #22556
Labels
Algos
Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
Bug
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone
Problem description
DataFrame.sort_values()
appears not to respect thena_position
parameter when sorting by a categorical series:Unexpectedly, the NaNs always come first regardless of
na_position
.Additional information
Series.sort_values()
works as expected:Strangely,
df.sort_values()
does seem to respectna_position
if you sort by more than one column (even the same column):Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: