V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  MisterLee  ›  全部回复第 1 页 / 共 1 页
回复总数  2
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   ·   实用小工具   ·   1032 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 22:04 · PVG 06:04 · LAX 15:04 · JFK 18:04
Developed with CodeLauncher
♥ Do have faith in what you're doing.