I have A dataframe like below,
df = pd.Dataframe({'Col1' : pd.Series(['Abc','Cde','Efg','Abc'], index=['a', 'b', 'c','d']),
'Col2' : pd.Series([10, 20, 30, 40], index=['a', 'b', 'c', 'd']),
'Col3' : pd.Series([1, 2., 3., 4.], index=['a', 'b', 'c', 'd'])})
By Depending on the value of the column value in Col1, I want to replace Col3 Value by Col2,
In this case where Col1 value is "Abc" I want to update Col3 value with Col2 value , expecting output like
pd.Dataframe({'Col1' : pd.Series(['Abc','Cde','Efg','Abc'], index=['a', 'b', 'c','d']),
'Col2' : pd.Series([10, 20, 30, 40], index=['a', 'b', 'c', 'd']),
'Col3' : pd.Series([10, 2., 3., 40], index=['a', 'b', 'c', 'd'])})
Tried by filter , that aint generic, so any proper method to do same !!