I have a DataFrame df with columns mean and spread
I try to create a new column based on condition like
if df['mean'] > df['spread']:
df['New Column'] = 1
elif df['mean'] == df['spread']:
df['New Column'] = 0
elif df['mean'] < df['spread']:
df['New Column'] = -1
It does not work, how can I process?
The error is
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Aucun commentaire:
Enregistrer un commentaire