파일합치기1 [CSV 다루기] Python으로 제목이 비슷한 csv 파일 합쳐주기 (feat.Pandas) [CSV 다루기] Python으로 제목이 비슷한 csv 파일 합쳐주기 (feat.Pandas) 한 폴더 내에서, 제목의 일부가 동일한 파일을 찾아서 둘을 합쳐주는 코드. import pandas import os filePath = 'C://Users//' #폴더주소 입력(윈도우 기준) fileAll = os.listdir(filePath) for i in range(len(fileAll)): # 폴더 내 파일 하나씩 검토함 for o in range(i+1, len(fileAll)): # 폴더 내 다른 파일과 파일명이 같은 경우가 있는지 확인함 if fileAll[i][:-4] in fileAll[o][:-4]: df_i = pd.read_csv(filePath + fileAll[i]) df_i.col.. 2021. 1. 21. 이전 1 다음