合并excel

import xlrd
import xlsxwriter
import os
import pandas as pd
import sys

# 文件夹名称
path = "D://01研/毕论/data/economics/原文/"

pathy = "D://01研/毕论/data/economics/引用/"

df1=pd.read_excel(path+'2016.xlsx')

df2=pd.read_excel(pathy+'2016.xlsx')
# 列名重复
df2=df2.rename(columns={'DOI': 'yin_DOI'})

df=df1.join(df2)

df.to_excel("D://01研/毕论/data/economics/原引/"+"2016.xlsx", index=False)

横向合并

df.join()

posted on 2022-09-08 16:19  cookie的笔记簿  阅读(23)  评论(0编辑  收藏  举报