python - Pandas: Join dataframes on selected columns -
i have 2 data frames following
data set id type msg 1 high lets 2 low whats 3 medium thats data set b id accounttype 2 facebook 3 linkedin
how can updated table of join in pandas, should
updated dataseta id account type msg 1 high lets 2 facebook low whats 3 linkedin medium thats
i can in sql update , inner join, how perform in pandas, tried it, of operations append/ merge. appreciated
try this:
df4 # id type msg # 0 1 high letsdo # 1 2 low whatsit # 2 3 medium thatsit df3: # id accounttype xxx # 0 2 facebook 24 # 1 3 linkedin 44 df4.merge(df3[['id','accounttype']],how='left').fillna("") # id type msg accounttype # 0 1 high letsdo # 1 2 low whatsit facebook # 2 3 medium thatsit linkedin
Comments
Post a Comment