Apr-10-2020, 09:39 PM
for data in alldata: if (data['Familysize']==1): data['isalone']=1What is the error in this simple code?
Error:ValueError Traceback (most recent call last)
<ipython-input-20-853203b87769> in <module>
1 for data in alldata:
----> 2 if (data['Familysize']==1):
3 data['isalone']=1
~\Anaconda3\lib\site-packages\pandas\core\generic.py in __nonzero__(self)
1553 "The truth value of a {0} is ambiguous. "
1554 "Use a.empty, a.bool(), a.item(), a.any() or a.all().".format(
-> 1555 self.__class__.__name__
1556 )
1557 )
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().