sample = pd.DataFrame({'Cat':['A','B','C','A','B','C','A','B','C'],
'Year':[2001,2002,2003,2001,2002,2003,2001,2002,2003]})
for s in sample.groupby(['Year']):
print s[0]
那会给予...
2001
2002
2003
如何按降序排序groupby结果以获得...
2003
2002
2001