Skip to content

Series.sort_values doesn't support a by keyword argument, but the documentation claims it does #11540

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

Closed
mineo opened this issue Nov 7, 2015 · 11 comments
Labels
Milestone

Comments

@mineo
Copy link
Contributor

mineo commented Nov 7, 2015

pandas: 0.17.0

import pandas
s = pandas.Series([1,2,3])
s.sort_values(by=["a"])

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-4a7ccaa074a5> in <module>()
      1 import pandas
      2 s = pandas.Series([1,2,3])
----> 3 s.sort_values(by=["a"])

TypeError: sort_values() got an unexpected keyword argument 'by'

https://github.com/pydata/pandas/blob/1135ce34fc2fb995e239a7d36aee1b687ef69dd9/pandas/core/series.py#L1609 does indeed not support by, but the docs list it as a supported keyword argument.

@jreback
Copy link
Contributor

jreback commented Nov 7, 2015

this is just using the super docs
want to do a pr to fix?

@jreback jreback added the Docs label Nov 7, 2015
@jreback jreback added this to the Next Major Release milestone Nov 7, 2015
@mineo
Copy link
Contributor Author

mineo commented Nov 7, 2015

Frame.sort_values and NDFrame.sort_values support by, though, so I'm not sure how to fix them.

@jreback
Copy link
Contributor

jreback commented Nov 7, 2015

take the by out of the shared docs and then add back as part of the doc string for DataFrame and NDFrame

@mineo
Copy link
Contributor Author

mineo commented Nov 8, 2015

Important things first: I still think pandas is a really cool thing ✨, but I give up :( Building the docs without conda is just too hard - installing everything from ci/requirements_dev.txt doesn't even get you into a state where python make.py html actually works, I had to install matplotlib manually and run python setup.py build_ext --inplace. The generated docs are now missing large parts of the API reference (including Series.sort_values). This might be fixed by installing everything in ci/requirements_all.txt but the package names in there differ from the package names on pypi and I don't have conda installed. I'm sorry, but I currently do not have the time to figure out how to use another tool for building python environments just to remove this one line of documentation, so don't expect a pull request from me.

@jreback
Copy link
Contributor

jreback commented Nov 8, 2015

@mineo

this is a doc-string! not the actual docs, you don't actually need to build the docs.

you can simply examine them from ipython: Series.sort_values?

though it IS pretty easy to build the docs (but you should for sure use conda if you do), see guidelines here

@jreback
Copy link
Contributor

jreback commented Nov 8, 2015

and you need cannot JUST install requirements_dev.txt that is just a minimal set. The docs are quite comprehensive on these points; you need quite a lot of deps to build the docs.

@varunkumar-dev
Copy link
Contributor

@jreback If I take the by out from the shared docs and then add "by" parameter as part of the doc string for DataFrame and NDFrame, it will not include "by" in the parameter section. It is showing "by" docstring on top of shared doc .
In that case , should I remove sort_values from shared docs and add different doc strings in Frame.sort_values and Series.sort_values ?

@pau1a
Copy link

pau1a commented Oct 31, 2017

I just came up against this tonight. I this just lingering? Is the documentation wrong or is this a bug?

@jorisvandenbossche
Copy link
Member

This should actually already be fixed by #13496 (released in 0.19.0) in the meantime.
@pau1a what version of pandas are you using?

@jorisvandenbossche jorisvandenbossche modified the milestones: Next Major Release, 0.19.0 Oct 31, 2017
@iamlydialawal
Copy link

Yeah this was not fixed...might coerce back into a df

@Aka-shi
Copy link

Aka-shi commented Aug 1, 2019

BUMP. Is this fixed? Still facing the same issue with .sort_values()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants