Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatched behavior of sorting functions for DataFrame vs. Series #10624

Closed
dlenski opened this issue Jul 19, 2015 · 1 comment
Closed

Mismatched behavior of sorting functions for DataFrame vs. Series #10624

dlenski opened this issue Jul 19, 2015 · 1 comment
Labels
API Design Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@dlenski
Copy link

dlenski commented Jul 19, 2015

The behavior of these methods differs in confusing ways:

DF:

  • DataFrame.sort_index takes a by parameter, in which case the index is resorted by a specific column's values
  • DataFrame.sort defaults to inplace=False
  • DataFrame.order does not exist

Series:

This makes it very hard to remember which one to use, especially after an aggregating function. For example:

df.max(axis=1).order(ascending=False)      # max returns a Series in this case, use Series methods
df.max(level='Foo').sort_index(by='Bar')      # max returns a DF in this case, use DF methods

Any reason not to make the inplace behavior identical for DataFrame.sort and Series.sort? Also, Series.sort_index could take by=0 to replicate the behavior of DataFrame.

@jreback
Copy link
Contributor

jreback commented Jul 19, 2015

see #9816 and others for discussion

@jreback jreback closed this as completed Jul 19, 2015
@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode API Design labels Jul 19, 2015
@jorisvandenbossche jorisvandenbossche added the Duplicate Report Duplicate issue or pull request label Jul 19, 2015
@jorisvandenbossche jorisvandenbossche added this to the No action milestone Jul 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

No branches or pull requests

3 participants