I'm trying to map the following function over a pandas dataframe (basically a list) in python 2.7:
df["Cherbourg"] = df["Embarked"].map(lambda x: if (x == "C") 1 else 0)
But python errors saying using a lambda function like this is a syntax error. Is there some way to map an if statement like this in python?