The Python Oracle

More idiomatic version of "df.isnull().any().any()" w/ a Pandas DataFrame?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001

--

Chapters
00:00 Question
00:31 Accepted answer (Score 4)
00:46 Thank you

--

Full question
https://stackoverflow.com/questions/2431...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #pandas

#avk47



ACCEPTED ANSWER

Score 4


I think it's to use numpy's any:

In [11]: df = pd.DataFrame([[1, 2], [3, np.nan]])

In [12]: df.isnull().any().any()
Out[12]: True

In [13]: np.any(df.isnull())
Out[13]: True