Mismatched behavior of sorting functions for DataFrame
vs. Series
#10624
Labels
API Design
Duplicate Report
Duplicate issue or pull request
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
The behavior of these methods differs in confusing ways:
DF:
DataFrame.sort_index
takes aby
parameter, in which case the index is resorted by a specific column's valuesDataFrame.sort
defaults toinplace=False
DataFrame.order
does not existSeries:
Series.sort
defaults toinplace=True
Series.order
defaults toinplace=False
, but is otherwise identical toSeries.sort
Series.sort_index
does not take aby
parameterThis makes it very hard to remember which one to use, especially after an aggregating function. For example:
Any reason not to make the
inplace
behavior identical forDataFrame.sort
andSeries.sort
? Also,Series.sort_index
could takeby=0
to replicate the behavior ofDataFrame
.The text was updated successfully, but these errors were encountered: