📅  最后修改于: 2022-03-11 14:45:49.141000             🧑  作者: Mango
import pandas as pd
df = pd.DataFrame({'A':[1, 2, 3, 4, 5, 6],
'B':[0, 1, 2, 0, 1, 2]})
df.groupby('B').apply(lambda x: x.sort_values('A', ascending = True))