I'm sorry to ask this apparently simple question, but I am a python beginner and couln't find an answer anywhere. I want to run a simple if statement, but python returns just:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
No matter which of the given alternatives I apply - it just doesn't work. Do you have any ideas?
import pandas as pd
df = pd.DataFrame({'a': [None] * 4, 'b': [2, 3, 10, 3]})
df["c"] =0
if df.b == 2:
df.c =1