Map an if statement in Python
Try
lambda x: 1 if x == "C" else 0
possible duplicate of Is there a way to perform "if" in python's lambda
Example :
map(lambda x: True if x % 2 == 0 else False, range(1, 11))
result will be - [False, True, False, True, False, True, False, True, False, True]
It will be simpler to just do this:
df["Cherbourg"] = (df["Embarked"] == "C").astype('int)