最初に、df['predicted_spread'] > df['vegas_spread']
の結果はブール値のブール値で構成されています(例:[True, True, False, ...]
)ので、エラーメッセージThe truth value of a Series is ambiguous
が表示されます。
あなたは何をすべきですか?それはあなたのアプリケーションに依存します。
(1)あなたの意図が
if (df['predicted_spread'] > df['vegas_spread']).all() is True:
total_bet += 1
そして、その後、
total_bet = sum(df['predicted_spread'] > df['vegas_spread'])
(2)あなたの意図はdf['predicted_spead'] > df['vegas_spread']
のすべてcomparationがtrueの場合total_bet
を増やすことであるならば、True
条件の数を数えることであるならば
(3)total_bet
もベクトルであり、あなたの意図は、各comparationを記録することであれば、その後、
total_bet = total_bet + (df['predicted_spread'] > df['vegas_spread'])
私はオプション(1)が必要なものだと思います。ありがとう。
これを見てください:http://stackoverflow.com/questions/10062954/valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-ambiguous – wwl
あなた最初にあなたのロジックをチェックして、何を達成したいのですか? 'df ['predicted_spread']> df ['vegas_spread']'は論理値を期待している間に論理系列を返します。 – Psidom