I would like to create a new column for this data frame, where I calculate the minimum between the column value and some global value (in this example 7). so my df has columns sessionand note, and my desired output column minValue:
session note minValue
1 0.726841 0.726841
2 3.163402 3.163402
3 2.844161 2.844161
4 NaN NaN
I use the built-in Python method min:
df['minValue']=min(7, df['note'])
and I have this error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
user5421875
source
share