Search code examples
pandasimportimporterror

Error when importing pandas to Jupyter notebook


I am trying to import pandas to Jupyter notebook and get the following error:

ImportError: cannot import name 'DtypeArg' from 'pandas._typing' (/Users/YA/opt/anaconda3/lib/python3.7/site-packages/pandas/_typing.py)

My code is literally one line so far: import pandas as pd. Please, help me understand what is happening. Thank you!


Solution

  • Try the following options in a regular terminal, (not in a Jupyter notebook or Jupyter terminal)

    Option 1:

    pip uninstall pandas
    pip install pandas --upgrade
    

    Option 2

    pip install pandas==1.1.5
    

    Source:

    https://github.com/pandas-dev/pandas/issues/42506#issuecomment-878501500