MisterLee 最近的时间轴更新
MisterLee

MisterLee

2006年美国《时代周刊》年度风云人物
V2EX 第 472680 号会员,加入于 2020-02-27 11:38:36 +08:00
MisterLee 最近回复了
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())
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4565 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 10:07 · PVG 18:07 · LAX 03:07 · JFK 06:07
Developed with CodeLauncher
♥ Do have faith in what you're doing.