I have the following df:
data = {
'A':[0,0,1,1,1,1,1,1,1],
'B':[0,0,1,1,0,1,4,1,2],
'C':[0,10,130,1,0,1,4,1,12]
}
X=5
df=pd.DataFrame(data)
df["D"]=min(df["A"],X)
print(df)
I've tried to create a new column - D, with the minimum value from A and X for each row but I'm getting the following error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().