Reputation: 405
This is my code to check if a certain cell in my Dataframe is empty.
Bfore there is a for loop to iterate over the rows. the counter is i
if change.isna(change.iloc[i,3]):
continue
Can't figure out why I receive the
**TypeError**: isna() takes 1 positional argument but 2 were given
Because I just pass one argument.... Or am I wrong?
Upvotes: 1
Views: 483
Reputation: 19123
The positional argument isna
takes is self
, because you're calling the method of pd.Dataframe
(change.isna()
). You're passing one argument, but that's the second argument to the function, hence the error.
Take a look at pd.Dataframe.isna
's documentation: there is only self
specified as argument. This is, because isna
actually returns a boolean array where for each element in the dataframe it tells you whether it's a valid value or NA.
if change.iloc[i].isna()[3]:
....
Alternatively, use the function pandas.isna()
, which takes exactly one object as argument:
if pd.isna(change.iloc[i,3]):
....
Upvotes: 2