-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Raise error on ascending='False' #41634
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
Comments
Hello, I am a new to open source contribution. Can I take up this enhancement? |
You can't be newer than me :)
If it's up to me, you have my blessings !
Ezer
…On Mon, May 24, 2021 at 1:15 PM Vishal Kumar Prasad < ***@***.***> wrote:
Hello, I am a new to open source contribution. Can I take up this
enhancement?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41634 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACPNI5NADVRFMFGDFOLOSMDTPIRL7ANCNFSM45L7FWRQ>
.
|
Hi @ezerkar, |
take |
Thanks to you all
בתאריך יום ב׳, 24 במאי 2021, 20:07, מאת Vishal Kumar Prasad <
***@***.***>:
… take
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#41634 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACPNI5K7K57KOUPOT2QXDNLTPKBW7ANCNFSM45L7FWRQ>
.
|
You can use sorted() function here.
Output: |
Hi Eric, I am already working on this enhancement. |
Hey, is this issue still open or taken? |
AFAIK it's taken
בתאריך יום ה׳, 27 במאי 2021, 18:07, מאת DaPy15 ***@***.***>:
… Hey, is this issue still open or taken?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#41634 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACPNI5K2T25A4H73SM7PXDDTPZN4DANCNFSM45L7FWRQ>
.
|
Hi all, while working on this problem, i figured another issue where if you put series.sort_values ascending parameter to 1 or 0, it fails. However according to the code, it shouldn't fail. |
Hello all! @vishalkumarprasad I have tried the test case you have described and it indeed fails. However, I have noticed that the is_bool() function - in pandas,core-, which raises the error, also fails with 0, 1 as input arguments. It seems to me that series.sort_values() works as expected. |
Hi all, @ninasiam If you look into the function definition of series.sort_values(), its clearly written that the ascending argument takes either bool or int or a sequence of bool or int. Hence there is mismatch somewhere, either in the function definition or is_bool() function or the implementation of is_bool() function. Please let me know your thoughts. |
Hello! @vishalkumarprasad I see your point, I have probably missed that :) I think the mismatch is probably due to the way is_bool() function is implemented. If I try:
The output is:
respectively. An easy fix, to avoid confusion for the time being, could be the update of the sort_values() function definition, to accept only True/False as input for the ascending parameter. |
Hello @ninasiam, |
take |
Is your feature request related to a problem?
when sort_values ascending parameter is set to a string (df.sort_values(col_name, ascending='False') it does not error although it's meaningless, this could be quite confusing.
Describe the solution you'd like
Raise an error if ascending is equal to values that are not boolean
API breaking implications
Error raising
Describe alternatives you've considered
Warning is also good, but I think error makes more sense
Additional context
for an hour I was wondering why ascending='False'
is not working
The text was updated successfully, but these errors were encountered: