I am new with panda. I've tried to look at the archive but could not find, or might be missing. the data:
d = {'A' : pd.Series([1., 2., 3., 4., 6.], index=['a', 'b', 'c', 'd','e']),'B' : pd.Series([3., 2., 1., 4., 7., 5.], index=['a', 'b', 'c', 'd', 'e', 'f',])}
df=pd.DataFrame(d)
df
what I want is trying to compare the value in 'A' vs 'B'. if value in 'B' is greater than that in 'A', I want to replace the value in 'B' with 'A' value.
the expected result in 'B' is becoming 1 (change), 2, 1, 4, 6 (change), 5
does anyone is willing to show me how to do it. many thanks,