ENH: Raise error on ascending='False'
See original GitHub issueIs 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
isinstance('False', bool) :)
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (3 by maintainers)
Top Results From Across the Web
If value found in column throw error and stop workflow
I have one column called "Check" Check column contains True or false only 2 values. If false appears in col workflow should give...
Read more >ascending=False is not working panda dataframe
It means there are not numeric values so sorted like strings in lexicographical order. For convert to numeric use to_numeric with errors='coerce ...
Read more >What's New — pandas 0.23.1 documentation
Bug in concat() where error was raised in concatenating Series with numpy ... Bug in Series.rank() and DataFrame.rank() when ascending='False' failed to ...
Read more >error handling; pandas and data analysis
we've already seen the raise keyword, in passing; raise Exception is ... ValueError : some variable is the right type but the wrong...
Read more >Extraversion and introversion - Wikipedia
The traits of extraversion (also spelled extroversion) and introversion are a central dimension in some human personality theories.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can use sorted() function here. Code:
Output:
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
take