I am trying to iterate over df[Age] column in a dataframe and trying to count the value digits if greater than 2 then df[Is_age]=='No' else 'Yes'. Is_age is new column I need to create based on age column values.
Age
23
25
<NA>
28
<NA>
I have tried below code:
Count=0
for i, j in df['Age'].iterrows():
if j==None:
df['Is_age']=='other'
else:
while(j!=None):
for k in j:
Count+=1
if(Count>2):
df['Is_age']=='No'
else:
df['Is_age']=='Yes'
But I am getting below error:
TypeError: 'NAType' object is not iterable
Can anyone suggest solution?