I'm newbie to pandas, and trying to replace a column value (NaN) in df1 with df2 with column value match. And facing the following error.
df1
unique_col | Measure
944537 NaN
7811403 NaN
8901242114307 1
df2
unique_col | Measure
944537 18
7811403 12
8901242114307 17.5
df1.loc[(df1.unique_col.isin(df2.unique_col) &
df1.Measure.isnull()), ['Measure']] = df2[['Measure']]
I have a two dataframes with 3 million records and on performing below operation facing the following error:
ValueError: cannot reindex from a duplicate axis