@jefferson77 wrote:
Hello I’m a pandas beginner.
I just want to compare values of a Serie with other values. This is an exampledf1 = pd.DataFrame({‘A’: [1,0,1,1,1,0,1,0]})
if df1[“A”] == 0:
df1[“test”] = 1
else:
df1[“test”] = 0The error is “The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().”
Please help me
Posts: 2
Participants: 2