2 回答
TA贡献1851条经验 获得超3个赞
您还可以使用:
df.append(df1,ignore_index=True).drop_duplicates(subset=['Pub Date','Forecast Time','Forecast Date','State'])
将两个数据帧视为:
df :
Pub Date Forecast Time Forecast Date State Temp
0 2018-12-12 23:00:00 2018-12-20 AK 3.0
1 2018-12-12 02:00:00 2018-12-20 AK 3.2
2 2018-12-12 05:00:00 2018-12-20 AK 2.9
df1:
Pub Date Forecast Time Forecast Date State Temp
0 2018-12-12 23:00:00 2018-12-20 AK 3.0
1 2018-12-13 02:00:00 2018-12-20 AK 3.2
2 2018-12-13 05:00:00 2018-12-20 AK 2.9
df.append(df1,ignore_index=True).drop_duplicates(subset=['Pub Date','Forecast Time','Forecast Date','State'])
Pub Date Forecast Time Forecast Date State Temp
0 2018-12-12 23:00:00 2018-12-20 AK 3.0
1 2018-12-12 02:00:00 2018-12-20 AK 3.2
2 2018-12-12 05:00:00 2018-12-20 AK 2.9
4 2018-12-13 02:00:00 2018-12-20 AK 3.2
5 2018-12-13 05:00:00 2018-12-20 AK 2.9
基本上仅基于某些列附加数据帧和删除重复项 ['Pub Date','Forecast Time','Forecast Date','State']
添加回答
举报