 |
|
MisterLee
2006年美国《时代周刊》年度风云人物
V2EX member #472680, joined on 2020-02-27 11:38:36 +08:00
|
MisterLee's recent replies
df_1 = df.groupby('A').apply(lambda x: x.sort_values('B')).reset_index(drop = True)
for item in df_1['A'].unique():
df_2 = df_1[df_1['A'] == item]
df_2.to_xxx #导出
——Python&Pandas
a_df= pd.DataFrame(a_list)
b_df= pd.DataFrame(b_list)
a_b_df = pd.concat([a_df, b_df], axis=0).drop_duplicates(['型号', '重量', '审核人'], keep='first')
c_list = []
for _, item in a_b_df.iterrows():
c_list.append(item.dropna().to_dict())