读取本月数据表格

table1 = pd.read_excel(r'F:\Python1\本月数据.xlsx')

读取上月数据表格

table2 = pd.read_excel(r'F:\Python1\上月数据.xlsx')

根据IP和MAC列进行合并删除重复项

df_merge = pd.merge(table1, table2, how='outer', on=['IP地址','网卡地址'], indicator=True) df_merge.drop_duplicates(subset=['IP地址', '网卡地址'], keep='first', inplace=True)

读取另一个表格

df_month = pd.read_excel(r'F:\Python1\excel1.xlsx')

table1-=-pdread_excelrFPython1本月数据xlsxntable2-=-pdread_excelrFPython1上月数据xlsxn#-根据IP和MAC列进行合并删除重复项ndf_merge-=-pdmergetable1-table2-how=outer-on=IP地址网卡地址-indicator=Truendf_mergedrop_duplicatessubset=IP地址-网卡地址-keep=first-inplace=Truenn#-df_month-=-pdre

原文地址: https://www.cveoy.top/t/topic/q13 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录