Issue
I have 2 dataframes. One has a bunch of columns including f_uuid
. The other dataframe has 2 columns, f_uuid
and i_uuid
.
the first dataframe may contain some f_uuid
s that the second dataframe doesn't and vice versa.
I want the first dataframe to have a new column i_uuid
(from the second dataframe) populated with the appropriate values for the matching f_uuid
in that first dataframe.
How would I achieve this?
Solution
df1 = pd.merge(df1,
df2,
on='f_uuid')
If you want to keep all f_uuid from df1 (e.g. those not available in df2), you may run
df1 = pd.merge(df1,
df2,
on='f_uuid',
how='left')
Answered By - fiphrelin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.