+ 2
counting unique values in DataFrame pandas
Series.value_counts(normalize=False, sort=True, ascending=False, bins=None, dropna=True) If sort=True, means descending order and ascending=False, means descending order then why both attributes are there ? Is there any special usecase ?
5 Answers
+ 3
From what I'm understand of the official documentation:
'sort' handle sort result by frequencies
'ascending' handle sort result by values
That's a slightly difference, but would explains why two different "attributes" (more correct to call them "arguments" ;))
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.value_counts.html
+ 3
I think there is an attribute for ascending order, so that you don't need need to additionally reverse the list to get the list in ascending order. This is particularly useful when you are working with a large set of data. Otherwise you would additionally need to flip the list after sorting, which will be less efficient.
+ 3
hm... did not notice the thing before.
Seems like sort=True and ascending=True both sorts the series.
Actually i am not that experienced with pandas.
+ 2
Pluto{^_^} please see this
+ 2
Pluto{^_^} but sort = False, will automatically make it in ascending order.