pandas -检查序列中所有值是否均为NaN [英] Pandas - check if ALL values are NaN in Series
本文介绍了 pandas -检查序列中所有值是否均为NaN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个看起来像这样的数据系列:
I have a data series which looks like this:
print mys
id_L1
2 NaN
3 NaN
4 NaN
5 NaN
6 NaN
7 NaN
8 NaN
我想检查的是所有值都是NaN.
I would like to check is all the values are NaN.
我的尝试:
pd.isnull(mys).all()
输出:
True
这是正确的方法吗?
推荐答案
是的,这是正确的,但是我认为更惯用的方式是:
Yes, that's correct, but I think a more idiomatic way would be:
mys.isnull().all()
这篇关于 pandas -检查序列中所有值是否均为NaN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文