This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("생성 파일:", merged_excel_file) # 생성한 엑셀 파일 경로 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DataFrame 데이터(total_df)를 생성한 엑셀 객체에 쓰기(옵션 지정) | |
total_df.to_excel(merged_excel_file, # 엑셀 파일 이름 | |
sheet_name='상반기_제품_판매량_통합', # 시트 이름 지정 | |
index=False) # DataFrame 데이터 index는 출력 안함 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
folder = 'C:/myPyExcel/data/ch07/sales_data/' | |
merged_excel_file = folder + '상반기_제품_판매량_통합.xlsx' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 생성할 통합 엑셀 파일 경로 지정 | |
folder = 'C:/myPyExcel/data/ch07/sales_data/' | |
merged_excel_file = folder + '상반기_제품_판매량_통합.xlsx' | |
# DataFrame 데이터(total_df)를 생성한 엑셀 객체에 쓰기(옵션 지정) | |
total_df.to_excel(merged_excel_file, # 엑셀 파일 이름 | |
sheet_name='상반기_제품_판매량_통합', # 시트 이름 지정 | |
index=False) # DataFrame 데이터 index는 출력 안함 | |
print("생성 파일:", merged_excel_file) # 생성한 엑셀 파일 경로 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total_df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for excel_file in excel_files: | |
# 각 엑셀 파일의 데이터 가져오기 | |
df = pd.read_excel(excel_file) | |
# 세로 방향으로 연결하기. 순차적으로 index 증가 | |
total_df = total_df.append(df, ignore_index= True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total_df = pd.DataFrame() # 빈 DataFrame 생성 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input_folder = 'C:/myPyExcel/data/ch07/sales_data/input' # 원본 데이터 폴더 | |
raw_data_dir = Path(input_folder) | |
excel_files = raw_data_dir.glob('상반기_제품_판매량_*') # 폴더 내 데이터 파일 이름 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from pathlib import Path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
NewerOlder