import pandas as pd
from pandas import DataFrame,Series
execl_total=pd.read_excel(r'E:/汇总.xlsx',sheet_name='Sheet1',index_col=0)
execl_a=pd.read_excel(r'E:/1.xlsx',sheet_name='Sheet1',index_col=0)
execl_b=pd.read_excel(r'E:/2.xlsx',sheet_name='Sheet1',index_col=0)
execl_c=pd.read_excel(r'E:/3.xlsx',sheet_name='Sheet1',index_col=0)
#删除“评估人员”为空的行数据
execl_a.dropna(subset=['评估人员'],inplace=True)
execl_b.dropna(subset=['评估人员'],inplace=True)
execl_c.dropna(subset=['评估人员'],inplace=True)
#loc[] 接受两个参数,并以','分隔。第一个位置表示行,第二个位置表示列。
#讲分表a\b\c中的行数据,赋值到总表对应Index的行中
for index in execl_a.index:
execl_total.loc[index,:] = execl_a.loc[index,:]
for index in execl_b.index:
execl_total.loc[index,:] = execl_b.loc[index,:]
for index in execl_c.index:
execl_total.loc[index,:] = execl_c.loc[index,:]
execl_total.to_excel('汇总.xlsx')
标签:execl,loc,index,python,excel,复制粘贴,pd,分表,total
From: https://www.cnblogs.com/zhouwp/p/16987162.html