1

Hey there I am relatively new to python. I have a hw assignment and it requires me to use an initial import of (import plotly.express as px). When I run the code it returns to me this (module 'pandas' has no attribute 'Panel'). I am using jupyter lab and I have been told that it has a lot of issues with plotly. I have also tried using jupyter notebook but still the same error. Some of my download versions include: Python-dotenv : 0.16.0 Python : 3.7.9 Nb_conda : 2.2.1 Nodejs : 14.8.0 Npm : 6.14.7 Holoviz : 0.11.3 Plotly : 4.14.3 Pandas : 1.2.4

Please let me know if you have any solutions to this problem. Thanks

3
  • I use pandas, plotly and jupyterlab all of the time. Just need to very carefully follow plotly instructions for jupyterlab. Your error does not appear to be wrt two import plotly.express as px but a line of functional code Commented May 15, 2021 at 18:09
  • 1
    Please provide code that creates error and full traceback Commented May 15, 2021 at 20:46
  • Does the exact same code (import plotly.express as px) work well when run in Python interpreter from command line? Commented May 15, 2021 at 23:11

2 Answers 2

1

As the Pandas' documentation states, the Panel attribute has been deprecated since version 0.20.0. You are using a version of Pandas (1.2.4) which does not have this attribute anymore. In other words, your code is too old for the version of Pandas in Jupyter Lab.

To solve this, you should follow the documentation and update the code to use either an xarray or a MultiIndex as a replacement to Panel.

Alternatively, a quick and dirty to solve this specific issue is to install a downgraded version of Pandas, but you'll probably have to downgrade a lot of other packages too. So I cannot recommend this option. Anyway, you can do this by adding a cell with this command, before the import and then restarting your notebook environment:

!pip install pandas==0.19.2
Sign up to request clarification or add additional context in comments.

Comments

1

I've been struggling with plotly.express and pandas in jupyter notebook as well. I've recently upgraded pandas to 1.3.0 and plolty to 5.1.0.

I had the same error, make sure you upgrade all dependencies as well along with pandas and plotly.

For me this command in the console did the trick:

pip install xarray --upgrade

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.