Skip to content

Instantly share code, notes, and snippets.

@wikibook
Created November 30, 2020 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wikibook/ce1cd440074b9f89711d8bdf2e5e8532 to your computer and use it in GitHub Desktop.
Save wikibook/ce1cd440074b9f89711d8bdf2e5e8532 to your computer and use it in GitHub Desktop.
import pandas as pd
from pathlib import Path
input_folder = 'C:/myPyExcel/data/ch07/sales_data/input' # 원본 데이터 폴더
raw_data_dir = Path(input_folder)
excel_files = raw_data_dir.glob('상반기_제품_판매량_*') # 폴더 내 데이터 파일 이름
total_df = pd.DataFrame() # 빈 DataFrame 생성
for excel_file in excel_files:
# 각 엑셀 파일의 데이터 가져오기
df = pd.read_excel(excel_file)
# 세로 방향으로 연결하기. 순차적으로 index 증가
total_df = total_df.append(df, ignore_index= True)
total_df # 통합한 DataFrame 데이터 출력
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment