I am pretty new to Python and I am trying to create a column in my pandas df using pre-exisitng columns (code below).
if ((df['a'] != -1) & (df['b'] == -1)):
df['c'] = df['a']
elif ((df['a'] == -1 ) & (df['b'] != -1)):
df['c'] = df['b']
else:
df['c'] = 0
However, I keep 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().
When I add '.any()', it still does not perform as needed. Am I totally off with this?