Answers for "nunique sort"

0

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
Posted by: Guest on July-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language