question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: Raise error on ascending='False'

See original GitHub issue

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

isinstance('False', bool) :)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Lokeshrathicommented, May 24, 2021

You can use sorted() function here. Code:

a = ("h", "b", "a", "c", "f", "d", "e", "g")
x = sorted(a)
print(x)

Output: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']

0reactions
gaikwadrahul20commented, Jul 23, 2021

take

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found