Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

nunique sort

df = df.groupby('A')['B'].nunique().sort_values(ascending=False).reset_index(name='count')
print (df)
   A  count
0  D      3
1  C      2
2  E      1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #nunique #sort
ADD COMMENT
Topic
Name
3+5 =