Reputation: 21
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
Upvotes: 1
Views: 681
Reputation: 500
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
Upvotes: 1
Reputation: 1228
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
Upvotes: 1