First, the result of df['predicted_spread'] > df['vegas_spread']
is also a Series consist of boolean value, e.g., [True, True, False, ...]
, so you get error message The truth value of a Series is ambiguous
.
So what should you do? That's depended on your application.
(1) if your intention is to count the number of True
condition, then
total_bet = sum(df['predicted_spread'] > df['vegas_spread'])
(2) if your intention is to increase total_bet
when all comparation of df['predicted_spead'] > df['vegas_spread']
is true, then
if (df['predicted_spread'] > df['vegas_spread']).all() is True:
total_bet += 1
(3) if total_bet
is also a vector, and your intention is to record each comparation, then
total_bet = total_bet + (df['predicted_spread'] > df['vegas_spread'])
I guess option (1) is what you need. Thanks.