Is it possible to fill a column according to other conditions?
I made a false algorithm:
if (df.b == 3) & (df.c == 0) & (df.a == None):
df['d'] == 0
else:
df['b']
and I tried
import pandas
df = pandas.DataFrame([{'a': None, 'b': 3, 'c': 0},
{'a': "string", 'b': 0, 'c': 3},
{'a': "string", 'b': 3, 'c': 0}])
df['d'] = [0 if ((df.b == 3) & (df.c == 0) & (df.a == None)) else pass]
SyntaxError: invalid syntax
I need
df = pandas.DataFrame([{'a': None, 'b': 3, 'c': 0, 'd': 0},
{'a': "string", 'b': 0, 'c': 3, 'd': 0},
{'a': "string", 'b': 3, 'c': 0, 'd': 3}])