Pandas populate new dataframe column based on matching columns in another dataframe

前端 未结 5 1670
花落未央
花落未央 2020-12-25 14:15

I have a df which contains my main data which has one million rows. My main data also has 30 columns. Now I want to add another column

5条回答
  •  北海茫月
    2020-12-25 15:09

    You may try the following. It will merge both the datasets on specified column as key.

    expected_result = pd.merge(df, df2, on = 'CATEGORY', how = 'left')
    

提交回复
热议问题