FutureWarning: In a future version of pandas all arguments of DataFrame.any and Series.any will be keyword-only

Viewed 21

Here is the Python statement creating the problem:

nan_rows = df[df.isnull().any(1)]

And it gives the following warning:

FutureWarning: In a future version of pandas all arguments of DataFrame.any and Series.any will be keyword-only.

It is a warning from production environment. I am sorry that I am not able to share the complete code as it is fairly complex to fit into this question.

How can I understand what this warning is saying, and how should I update this line of code?

1 Answers

Starting from pandas 1.5, you get a FutureWarning.

You must specify axis=1:

nan_rows = df[df.isnull().any(axis=1)]

In a future version only keywords arguments will be accepted, omitting the keyword will raise an error.

Related