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
Tony Stark