轉發:Python - pandas DataFrame數據的合並與拼接(merge、join、concat)
總結得很全面!
比如將一個文件夾下所有文件合並:
#merge
# import os
#import pandas as pd
# file_list = []
# path = r'input file path /'
# for file in os.listdir(path):
# df = pd.read_csv(path+file)
# file_list.append(df)
# all_VA = pd.concat(file_list)
# all_VA.to_csv(path+'5455.csv',index = False)
# print('done!')