I have the below series:
my_series = pd.Series([np.nan, np.nan, ['A', 'B']])
I have to loop through my_series and evaluate whether the value is NaN or not and then do something (actions defined as 'do A' and 'do B' for the sake of simplicity).
1st try:
for element in my_series:
if element.isna():
print('do A')
else:
print('do B')
When running it, I've got the error: "'float' object has no attribute 'isna'"
2nd try from the question: Error: float object has no attribute notnull
for element in my_series:
np.where(element.isnull(), 'do A', 'do B')
When running it, I've got the error: "AttributeError: 'float' object has no attribute 'isnull'"
I haven't found any other similar question here at StackOverflow, I don't know what else to try.