I would like create new column for given dataframe where I calculate minimum between the column value and some global value (in this example 7). so my df has the columns session
and note
and my desired output column is minValue
:
session note minValue
1 0.726841 0.726841
2 3.163402 3.163402
3 2.844161 2.844161
4 NaN NaN
I'm using 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().