Error: The truth value of a series is ambiguous. Python & Pandas

馋奶兔 提交于 2019-12-02 10:07:16

The problem is that the condition (data.Vol > 10000) returns an array of boolean values. NumPy emits that error because it can't know whether you mean to ask "are any of these values > x?", "are all of these values > x?", etc.

In this case you should use logical indexing to get the rows you're interested in: data[data.Vol > 10000].

From there, you can get all the relevant symbols: data[data.Vol > 10000].index.get_level_values('Symbol')

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!