[Pandas] merge 병합
2019. 9. 16. 16:50ㆍIT/Pandas : 데이터
pd.merge(dfA[['col1','col2']], dfB[['col1','col2']], on='key')
2개의 데이터프레임에서 원하는 칼럼만 추출하여 결합
df = pd.merge(df,df2[['Key_Column','Target_Column']],on='Key_Column', how='left')
출처 : https://stackoverflow.com/questions/17978133/python-pandas-merge-only-certain-columns
pd.merge(how='left')
결합하는 방법의 종류. 총 4가지 방법이 있음
result = pd.merge(user_usage,
user_device[['use_id', 'platform', 'device']],
on='use_id',
how='right')

출처 : https://www.shanelynn.ie/merge-join-dataframes-python-pandas-index-1/
'IT > Pandas : 데이터' 카테고리의 다른 글
| [Pandas] DataFrame (0) | 2019.09.16 |
|---|---|
| [Pandas] 전처리 (0) | 2019.09.16 |
| [Pandas] plot 그래프 (0) | 2019.09.16 |
| [Pandas] 데이터 형태 (0) | 2019.09.16 |
| [Pandas] read_csv 기능 설명 (0) | 2019.09.16 |