Python any函数

来源:互联网 发布:java参数引用传递 编辑:程序博客网 时间:2024/04/29 18:18
(a.loc[i,['Count']]==y_count[1])#输出
#Out[391]: #Count    True#Name: 1, dtype: bool

 if(a.loc[i,['Count']]==y_count[1]):print("da")
Traceback (most recent call last):


  File "<ipython-input-390-0a73d4feade7>", line 1, in <module>
    if(a.loc[i,['Count']]==y_count[1]):print("da")


  File "C:\Anaconda34\lib\site-packages\pandas\core\generic.py", line 731, in __nonzero__
    .format(self.__class__.__name__))


ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
if any((a.loc[i,['Count']]==y_count[2])):print("da")if any((a.loc[i,['Count']]==y_count[1])):print("da")da

这里和迭代器有关的问题。用到了any函数、empty函数、all函数。

好吧,之后想起来补充

0 0
原创粉丝点击