-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: DataFrame sort columns by rows: sort_values(axis=1) #13622
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
Conversation
Current coverage is 84.38%@@ master #13622 diff @@
==========================================
Files 138 142 +4
Lines 51100 51222 +122
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43097 43223 +126
+ Misses 8003 7999 -4
Partials 0 0
|
@@ -229,6 +229,7 @@ Other enhancements | |||
- ``pd.read_html()`` has gained support for the ``decimal`` option (:issue:`12907`) | |||
- A top-level function :func:`union_categorical` has been added for combining categoricals, see :ref:`Unioning Categoricals<categorical.union>` (:issue:`13361`) | |||
- ``Series`` has gained the properties ``.is_monotonic``, ``.is_monotonic_increasing``, ``.is_monotonic_decreasing``, similar to ``Index`` (:issue:`13336`) | |||
- ``DataFrame.sort_values()`` has gained support for re-ordering columns by index label (:issue:`10806`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not clear what actually you are changing. This is for axis 1 support for by
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't they mean the same thing? (by
is always required sort_values
, and axis 1 is equivalent to "columns".) See if the new wording in 2773cdf hits what you're getting at, otherwise can you please specify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rewording in that commit is good! (exactly what I wanted to suggest to combine both :-))
Maybe just "with" after "columns"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Looks good. @jreback OK for you? |
@@ -229,6 +229,7 @@ Other enhancements | |||
- ``pd.read_html()`` has gained support for the ``decimal`` option (:issue:`12907`) | |||
- A top-level function :func:`union_categorical` has been added for combining categoricals, see :ref:`Unioning Categoricals<categorical.union>` (:issue:`13361`) | |||
- ``Series`` has gained the properties ``.is_monotonic``, ``.is_monotonic_increasing``, ``.is_monotonic_decreasing``, similar to ``Index`` (:issue:`13336`) | |||
- ``DataFrame.sort_values()`` has gained `axis=1` support to re-order columns with `by=index_label` (:issue:`10806`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use double-backquotes around axis=1 and by=index_label
(though I am not entirely sure what that means). you can say by=
I think the index_label
is confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by=index_label
is straight from your issue title: #10806 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, yeah it is. I don't even remember what it is! hah, and a user certainly won't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double backticks I understand. As for re-wording with respect to by
, my previous commit did not specify this but you said that was unclear too. Could you please specify how you'd like this line to read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback What do you think of ".. support to re-order the columns based on the values in a row using df.sort_values(by='index_label', axis=1)
)"
Could also add a small example
@@ -229,6 +229,13 @@ Other enhancements | |||
- ``pd.read_html()`` has gained support for the ``decimal`` option (:issue:`12907`) | |||
- A top-level function :func:`union_categorical` has been added for combining categoricals, see :ref:`Unioning Categoricals<categorical.union>` (:issue:`13361`) | |||
- ``Series`` has gained the properties ``.is_monotonic``, ``.is_monotonic_increasing``, ``.is_monotonic_decreasing``, similar to ``Index`` (:issue:`13336`) | |||
- ``DataFrame`` has gained support to re-order the columns based on the values in a row using ``df.sort_values(by='index_label', axis=1)`` (:issue:`10806`) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just this sentence is fine, but use: df.sort_values(by=...., axis=1)
ok minor comments, ps rebase and ping on green. |
@IamJeffG fixed the remaining comments when merging (we already asked you to update the whatsnew sentence enough :-)) |
Thanks for taking care of it @jorisvandenbossche ! |
(and now your geopandas PR .. :-) I try to take a look this evening!) |
git diff upstream/master | flake8 --diff