import pandas as pd
df = pd.DataFrame([['A',1,'2019-03-01 00:00:30'],
['A',3,'2019-04-01 00:00:30'],
['A',2,'2019-03-01 00:00:30'],
['B',5,'2019-03-01 00:00:30'],
['B',9,'2019-03-01 00:00:29']],
columns = ['name','score','tm'])
df.sort_values(['name','tm'], ascending = [False,True], inplace=True)
pandas实现分组排序
最新推荐文章于 2024-05-11 11:02:50 发布