'DataFrame'对象没有属性'isna' [英] 'DataFrame' object has no attribute 'isna'

查看:171
本文介绍了'DataFrame'对象没有属性'isna'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为一个项目改编了一种机器学习代码.该代码在笔记本电脑上运行良好,现在在台式机上出现了问题.我正在检查所有数据框列中是否缺少值.

I have adapted one machine learning code for one my project.The code that worked fine on my laptop ,now makes problems on my desktop.I am checking all data frame columns for missing values.

  File "g100.py", line 11, in <module>
    print(dfs.columns[dfs.isna().any()].tolist()) 
AttributeError: 'DataFrame' object has no attribute 'isna'

我安装的熊猫版本和依赖项

My installed panda versions and dependencies

d.show_versions(as_json=False)

INSTALLED VERSIONS
------------------
commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.13.0-37-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.20.3
pytest: 3.4.2
pip: 9.0.3
setuptools: 38.5.1
Cython: None
numpy: 1.11.3
scipy: 0.19.0
xarray: None
IPython: 6.2.1
sphinx: None
patsy: 0.5.0
dateutil: 2.6.0
pytz: 2017.3
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.2
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: 0.9999999
sqlalchemy: 1.1.9
pymysql: None
psycopg2: 2.7.4 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
pandas_gbq: None
pandas_datareader: 0.6.0

我可以找到一个解释,为什么isna给我一个AttributeError.

I can find an explanation why isna gives me an AttributeError.

推荐答案

如果您比较使用" rel ="nofollow noreferrer" > 0.22 ,您可以看到前者使用isnull,而后者使用isna.

If you compare the 0.20 documentation for "Working with missing data" with that of 0.22, you can see that the former uses isnull, whereas the latter uses isna.

实际上,isnull 0.22文档状态

isna的别名

alias of isna

对于您的版本,请尝试isnull.

For your version, try isnull, therefore.

这篇关于'DataFrame'对象没有属性'isna'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆