【发布时间】:2020-02-20 05:15:26
【问题描述】:
如何设置格式以便能够使用 if 语句进行测试?
result = dfrow.str.contains('Animation')
x = 0
print(result)
if result == False:
x = 1
if result == True:
x = 2
打印函数输出:
1 False
Name: genres, dtype: bool
给出的错误:
----> 4 if result == False:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
【问题讨论】:
标签: python pandas dataframe valueerror