0
我想两列的值用下面的代码比较:在大熊猫比较两列
if df['predicted_spread'] > df['vegas_spread']:
total_bet += 1
它返回以下错误:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
任何想法如何,我可以解决这个问题?
看看这个: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