-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Clarify rank documentation #40016
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
smallest -> lowest
Top/bottom give the lowest/highest rank, regardless of if ascending is True or False
although irrelevant, the last example is wrong, actually gives:
but this lgtm, |
Sorry @attack68, yes you are right, I copy pasted the wrong one. Thanks. |
I think this is a bug rather than an issue with the documentation, no? |
First I thought that as well, but the behaviour actually makes sense to me in the sense that a ranking goes from 1 (lowest/top) to n (highest/bottom), and na_option determines if you want your nans at the top or bottom of the ranking (regardless of ascending). |
@WillAyd I think the issue is with semantics. If you rank values either 'ascending' or 'descending' and then insert an 'NaN' either at 'top' or 'bottom', does 'top' refer to assigning the highest 'value' to 'NaN' in which case 'ascending' places it with the highest rank and 'descending' the lowest? Or does it place the 'NaN' at the 'top' of the rankings (i.e. lowest rank) or the 'bottom'. I think the use of 'top' and 'bottom' is terrible. I prefer the latter approach but would think 'na_rep' = {'lowest_rank', 'highest_rank'} is clearer and this is essentially what it is doing for {'top', 'bottom'}. |
@attack68 Personally I think this can be solved with clearer documentation as it's all about terminology, rather than changing the API. I think it needs to be explained as in #40016 (comment). I'm not a maintainer so up to you guys. Happy to create PR on that though if that is the route you want to go down. |
@ptype, sure but is |
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
I think it should still be considered for inclusion |
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.
i think this documentation is clearer, if not ideal. LGTM
@ptype can you merge master, and make sure the CI is green, so we can merge, please? Ping me once it's green, thanks! |
@datapythonista thanks, I've fetched from master and reran CIs, all green |
Thanks @ptype |
Example of top/bottom behaviour vs ascending: