I have a dataframe with a column whose values look something like:
YEAR_TORONTO
0 <NA>
1 2016
2 <NA>
3 1999
I need to check each element of this dataframe individually via a for
loop for other reasons outside this segment of code, so I'm looking for solutions that comply with my implementation.
Essentially the code I have at the moment to check the presence of is:
if np.isnan(df.get("YEAR_TORONTO")[row]):
This leads to me getting the following error for the <NA>
values:
boolean value of NA is ambiguous
Any idea of what I can do to fix this error? Help much appreciated
pd.isna()
? pandas.pydata.org/pandas-docs/stable/reference/api/… – Herbertpd.NA
is not reallynp.nan
. – Augusto