问题复现
笔者在学习TensorFlow 2.0的过程中,突然发现无法无法导入pandas模块,然后通过conda install pandas 命令进行安装。接着在第二次打开Spyder的时候,报错如下

问题定位
观察其最后的错误位置,定位到 dataframeeditor.py 文件
from spyder.plugins.variableexplorer.widgets.dataframeeditor import (
File “E:\Develop\AnaConda3\envs\testIAS\lib\site-packages\spyder\plugins\variableexplorer\widgets\dataframeeditor.py”, line 47, in
from pandas import DataFrame, Index, Series, isna
ImportError: cannot import name ‘isna’
解决方案
发现是 该版本的 pandas模块 无 isna函数,
重新改为 isnull函数即可。
具体而言,修改文件
AnaConda3安装目录\envs\当前环境\lib\sitepackages\spyder\plugins\variableexplorer\widgets\dataframeeditor.py
中行47的
from pandas import DataFrame, Index, Series, isna
修改为
from pandas import DataFrame, Index, Series, isnull
同时,修改行294
if self.max_min_col[column] is None or isna(value):
为
if self.max_min_col[column] is None or isnull(value):
或者直接通过 替换操作 将 isna 替换为 isnull。
在学习TensorFlow2.0时遇到pandas导入问题,错误显示isna函数不可用。解决方案是由于该版本pandas未包含isna,需将dataframeeditor.py中isna替换为isnull。修改后问题解决。
4743

被折叠的 条评论
为什么被折叠?



