For example, if first data frame df1
is:
'a''b''value'0 1 2 11 2 3 1
and second data frame df2
is
'a''b'0 1 2
I would like to get something like
'a''b''value'0 1 2 01 2 3 1
For all the rows in df1(excluding 'value' column) that match the rows in df2, I would like to change the 'value' column of these rows in df1 from 1 to 0. I can find the common rows by using df1.merge(df2, on=['a','b'])
. But how do I change the value?