Mapping Column Value Based On Another Column In Python
I am trying to change column value depends from the other column along its row then merge it to an existing excel file using the ADSL column as my key. I have a Data like this: ADS
Solution 1:
I believe need map
by Series
:
df2['Status'] = df2['Status'].map(df1.set_index('Result')['Status'])
If some values are not match is possible replace by original non NaN
s values:
df2['Status'] = df2['Status'].map(df1.set_index('Result')['Status']).fillna(df2['Status'])
Post a Comment for "Mapping Column Value Based On Another Column In Python"