I have a column in my Data-Frame and ]t should have a "Yes" values, But my Unit-Test code has an error. Here is my code:
data = func("value") assert all("Yes" in data == True) The error is :
'bool' object is not iterable I have a column in my Data-Frame and ]t should have a "Yes" values, But my Unit-Test code has an error. Here is my code:
data = func("value") assert all("Yes" in data == True) The error is :
'bool' object is not iterable If you simply want to check that one "Yes" string exists in the data variable
assert "Yes" in data If you want to use check every element of the list is "Yes"
assert all(x == "Yes" for x in data) However, this is for lists, not dataframes. If you have a pandas dataframe
assert data['column'].str.contains('Yes')