dataframe中groupby的数据形式转换

一般用groupby后,会做一些计算之类的,但是有个需求只想groupby不想做sum,count之类的

cmfassetportfolio.groupby('s_info_windcode').apply(lambda x:x.sort_values('f_prt_enddate',ascending=False)).reset_index(drop=True)

原文地址:https://www.cnblogs.com/xiaodongsuibi/p/12130359.html