티스토리 뷰

728x90
반응형

 

 

조인하고 싶은 데이터프레임을 리스트에 넣고

ft.reduce, lambda를 이용해 조인하는 방식 사용!

 

how에는 원하는 조인방식을,

on에는 조인할때 기준이 되는 키값을 넣으면 됩니다.

조인타입에는 outer, left, right, inner 등이 있습니다

 

import pandas as pd
import functools as ft

csvList = [ pd.DataFrame(), pd.DataFrame(), pd.DataFrame(),  .... ]
file = ft.reduce(lambda left, right: pd.merge(left, right, how="inner", on="key"), csvList)

 

 

join type 등에 대해서 아주 자세히 작성되어있는 게시물 참고!

https://www.shanelynn.ie/merge-join-dataframes-python-pandas-index-1/

 

Learn to Merge and Join DataFrames with Pandas and Python

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

www.shanelynn.ie

 

728x90
반응형
댓글