I am trying to create a for loop that iterates through a pandas Series, ageNew
, that fills a list, label
, based on the contents of the pandas Series.
This is the code that I have which outputs errors:
In:
for i in ageNew.items():
if ageNew[i] <= 100:
val = 0
else:
val = 1
label.append(val)
Out:
KeyError: (0, 218)