I am trying to do comparison on two values in each row. If the first value is smaller than the second one, don't change it. Otherwise, change it to the second one. Here is my code.
dataFrame = pd.DataFrame({"value":[1,10,8,9,7],"max":[5,8,7,10,6]})
dataFrame['value'].apply(lambda x: dataFrame['max'] if x > dataFrame["max"] else x)
And here is my error. "ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."
I kinda understand what this error is about, it's saying that two Series of values when they do comparison, the trues/falses are also a series. But how could I do comparison on two column values in each row and then fill a value in one column of that row.