Importing Pandas gives error AttributeError: module 'pandas' has no attribute 'core' in iPython Notebook

前端 未结 19 727
夕颜
夕颜 2020-11-30 09:50

I am running a iPython notebook via the Anaconda Navigator app (version 1.1.0). When I want to import pandas it gives me a strange error. I thought the Anaconda app included

相关标签:
19条回答
  • 2020-11-30 10:21

    Try in your console

    conda install pandas
    

    and see what's the message given.

    0 讨论(0)
  • 2020-11-30 10:24

    yes, the Anaconda distribution includes pandas, type

    conda list
    

    to get a list of the packages installed.

    0 讨论(0)
  • 2020-11-30 10:25

    I had a similar issue since I installed pandas using python -m pip install pandas --upgrade --user which installed a conflicting version in my user python packages directory, masking the Anaconda installed version that other dependencies relied upon.

    conda list | grep pandas
    pandas == 0.23.4
    
    python -m pip list | grep pandas
    pandas == 0.24.0
    

    So uninstalling the user directory masked version cleaned up the issue for me.

    python -m pip uninstall pandas
    

    For reference all possible python packages are installed in the directories listed from this command:

    python -m site
    

    Might be worth iterating through these and checking for duplicates.

    Edit: Since my original answer I learnt you can run:

    python -m pip list -v
    

    And it shows the directory the library is installed. This often shows whether the library you want is in a virtual environment, conda environment, user directory, system site packages etc.

    0 讨论(0)
  • 2020-11-30 10:26

    I faced the same problem and I solved it using the following steps:

    1. Open "Anaconda Prompt" [For Windows]
    2. Run "conda uninstall pandas".
    3. Run "conda install pandas".

    Actually, there is a pandas version conflict, which would get resolved automatically by following the above steps.

    Stay Blessed!

    0 讨论(0)
  • 2020-11-30 10:27

    There's this bug in the latest version of pandas (pandas 0.23) that gives you an error on importing pandas.

    But this can be easily fixed by installing an earlier version of pandas (pandas 0.22) using the command pip install pandas==0.22 on Windows Command Prompt.

    0 讨论(0)
  • 2020-11-30 10:27

    I recently came across the same problem right after I installed Pandas 0.23 in Anaconda Prompt. The solution is simply to restart the Jupyter Notebook which reports the error. May it helps.

    0 讨论(0)
提交回复
热议问题