Conditionally update Data Frame column
<p>I'm trying to update a column from a value of 0 to a value of 1 if certain conditions are true. Here is my code:</p>

<pre><code>df_['win'] = 0
df_.loc[df_['predicted_spread'] &gt; df_['vegas_spread'] and df_['actual_spread'] &gt; df_['vegas_spread'], 'win'] = 1
</code></pre>

<p>This is the error I'm getting:</p>

<pre><code>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
</code></pre>

<p>Does anybody have any ideas of what's going on here?</p>

<p>Try</p>

<pre><code>df_['win'] = 0
df_.loc[df_['predicted_spread'].gt(df_['vegas_spread']) and df_['actual_spread'].gt(df_['vegas_spread']), 'win'] = 1
</code></pre>

python pandas