Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python JupyterLab中未装载的熊猫_Python_Pandas_Anaconda - Fatal编程技术网

Python JupyterLab中未装载的熊猫

Python JupyterLab中未装载的熊猫,python,pandas,anaconda,Python,Pandas,Anaconda,在JupyterLab中使用Python3和Pandas进行了数周的数据科学项目,没有任何问题。今天,我无法通过标准的将熊猫导入为pd加载熊猫。(请参阅下面的错误消息) 我已经试着检查确保熊猫安装在我的蟒蛇环境中。在寻找我的Anaconda环境资源后,我运行了pip列表和conda列表,并且都显示了pandas 0.25.0,安装在Anaconda环境的软件包列表中 想知道这是否与JupyterLab最近更新到1.0.2版和Jupyter Notebook更新到6.0.0版有关 我希望导入熊猫作

在JupyterLab中使用Python3和Pandas进行了数周的数据科学项目,没有任何问题。今天,我无法通过标准的
将熊猫导入为pd
加载熊猫。(请参阅下面的错误消息)

我已经试着检查确保熊猫安装在我的蟒蛇环境中。在寻找我的Anaconda环境资源后,我运行了
pip列表
conda列表
,并且都显示了pandas 0.25.0,安装在Anaconda环境的软件包列表中

想知道这是否与JupyterLab最近更新到1.0.2版和Jupyter Notebook更新到6.0.0版有关

我希望
导入熊猫作为pd
可以正常工作,但我得到的是:

    ---------------------------------------------------------------------------
    UnboundLocalError                         Traceback (most recent call last)
    <ipython-input-2-7dd3504c366f> in <module>
    ----> 1 import pandas as pd

    ~/anaconda3/lib/python3.7/site-packages/pandas/__init__.py in <module>
         40 import pandas.core.config_init
         41 
    ---> 42 from pandas.core.api import *
         43 from pandas.core.sparse.api import *
         44 from pandas.tseries.api import *

    ~/anaconda3/lib/python3.7/site-packages/pandas/core/api.py in <module>
         24 )
         25 from pandas.core.arrays import Categorical, array
    ---> 26 from pandas.core.groupby import Grouper
         27 from pandas.io.formats.format import set_eng_float_format
         28 from pandas.core.index import (Index, CategoricalIndex, Int64Index,

    ~/anaconda3/lib/python3.7/site-packages/pandas/core/groupby/__init__.py in <module>
          1 from pandas.core.groupby.groupby import GroupBy  # noqa: F401
    ----> 2 from pandas.core.groupby.generic import (  # noqa: F401
          3     SeriesGroupBy, DataFrameGroupBy, PanelGroupBy)
          4 from pandas.core.groupby.grouper import Grouper  # noqa: F401

    ~/anaconda3/lib/python3.7/site-packages/pandas/core/groupby/generic.py in <module>
         40 import pandas.core.indexes.base as ibase
         41 from pandas.core.internals import BlockManager, make_block
    ---> 42 from pandas.core.panel import Panel
         43 from pandas.core.series import Series
         44 

    ~/anaconda3/lib/python3.7/site-packages/pandas/core/panel.py in <module>
       1584                   docs={})
       1585 
    -> 1586 ops.add_special_arithmetic_methods(Panel)
       1587 ops.add_flex_arithmetic_methods(Panel)
       1588 Panel._add_numeric_operations()

    ~/anaconda3/lib/python3.7/site-packages/pandas/core/ops/__init__.py in add_special_arithmetic_methods(cls)
        810         special methods will be defined and pinned to this class
        811     """
    --> 812     _, _, arith_method, comp_method, bool_method = _get_method_wrappers(cls)
        813     new_methods = _create_methods(
        814         cls, arith_method, comp_method, bool_method, special=True

    ~/anaconda3/lib/python3.7/site-packages/pandas/core/ops/__init__.py in _get_method_wrappers(cls)
        717         comp_special = _comp_method_FRAME
        718         bool_special = _arith_method_FRAME
    --> 719     return arith_flex, comp_flex, arith_special, comp_special, bool_special
        720 
        721 

    UnboundLocalError: local variable 'arith_flex' referenced before assignment
---------------------------------------------------------------------------
取消绑定LocalError回溯(最近一次调用上次)
在里面
---->1进口熊猫作为pd
~/anaconda3/lib/python3.7/site packages/pandas/\uuuuu init\uuuuuuuuu.py in
40导入pandas.core.config_init
41
--->42从pandas.core.api导入*
43从pandas.core.sparse.api导入*
44从pandas.tseries.api进口*
~/anaconda3/lib/python3.7/site-packages/pandas/core/api.py in
24 )
25从pandas.core.array导入分类数组
--->26来自pandas.core.groupby进口石斑鱼
27来自pandas.io.formats.format导入集\u eng\u float\u format
28从pandas.core.index导入(索引、分类索引、Int64Index、,
~/anaconda3/lib/python3.7/site packages/pandas/core/groupby/\uuuuu init\uuuuuuuuuu.py in
1来自pandas.core.groupby.groupby导入groupby#noqa:F401
---->2来自pandas.core.groupby.generic import(#noqa:F401
3系列GroupBy、DataFrameGroupBy、PanelGroupBy)
4来自pandas.core.groupby.grouper进口石斑鱼#noqa:F401
~/anaconda3/lib/python3.7/site-packages/pandas/core/groupby/generic.py in
40.core.index.base作为ibase导入
41从pandas.core.internals导入块管理器,生成块
--->42来自pandas.core.panel导入面板
43来自pandas.core.series进口系列
44
~/anaconda3/lib/python3.7/site-packages/pandas/core/panel.py in
1584文件={})
1585
->1586操作。添加特殊算法(面板)
1587操作。添加灵活的算术方法(面板)
1588面板。添加数值操作()
添加特殊算术方法(cls)中的~/anaconda3/lib/python3.7/site packages/pandas/core/ops/\uuuuuu init\uuuuuuuuuu.py
810个特殊方法将被定义并固定到此类
811     """
-->812 u、u、arith_方法、comp_方法、bool_方法=_get_方法_包装器(cls)
813新方法=\u创建\u方法(
814 cls,算术法,比较法,布尔法,特殊=真
~/anaconda3/lib/python3.7/site packages/pandas/core/ops/\uuuuuuu init\uuuuuuuuuu.py in\u get\u method\u wrappers(cls)
717补偿特殊=\u补偿方法\u框架
718 bool\u special=\u arith\u方法\u框架
-->719返回算术弹性、算术弹性、算术特殊、算术特殊、算术特殊、布尔特殊
720
721
UnboundLocalError:赋值前引用的局部变量“arith_flex”

感谢您的帮助或建议。

我最终通过使用卸载并重新安装Anaconda解决了此依赖性问题。这部分与@Trenton_M的建议/信息一致,因为重新安装将Pandas从0.25.0版回滚到0.24.2版,同时保留JupyterLab 1.0.2版和Jupyter Notebook 6.0版。0

pandas.__version__
输出

'0.24.2'

这就是。

如果您使用conda更新,您将不会有pandas 0.25。但是,如果您使用pip更新pandas,您可能已经破坏了一个依赖关系。如果您使用conda env,我建议删除pandas并使用conda重新安装它。我只对conda不提供的包使用pip,所以我不会破坏任何东西。@Trenton\M谢谢你的建议。我相信本周早些时候pandas 0.25可以使用,但卸载和重新安装值得一试。完成后我会更新。@Trenton\u谢谢你的建议。重新安装Anaconda解决了问题。请记住,不要用
pip
更新
conda
环境中的软件包。它会l最有可能损坏您的环境。也就是说,我必须定期重新安装
Anaconda
,我认为这会更好。我在安装带有
pip
的软件包时没有遇到任何问题,如果您想要当前版本,那么
conda
conda install pandas=0.25.0
。它将安装from
conda forge
,因此您可能需要在
.condarc
文件的
频道下设置
-conda forge
。您可以单独查找。