[英]The plotly.grid_objs module is deprecated for jupyter notebook offline plot
I am following a tutorials in plotly official website.我正在关注plotly官方网站上的教程。 I am using jupyter notebook.
我正在使用 jupyter 笔记本。 and I got an import error for plot.grid_objs.
我收到 plot.grid_objs 的导入错误。 I am using plotly 4.0.
我正在使用 plotly 4.0。 Any suggestion to fix it?
有什么建议可以解决吗? Thanks
谢谢
https://plotly.com/python/v3/gapminder-example/ https://plotly.com/python/v3/gapminder-example/
ImportError: The plotly.grid_objs module is deprecated, please install the chart-studio package and use the chart_studio.grid_objs module instead ImportError: plotly.grid_objs 模块已弃用,请安装 chart-studio package 并改用 chart_studio.grid_objs 模块
import plotly as py
import plotly.figure_factory as FF
from plotly.grid_objs import Grid, Column
import pandas as pd
import time
import pickle
filename_pickle='dataset.pkl'
try:
dataset=pd.read_pickle(filename_pickle)
except FileNotFoundError:
url = 'https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv'
dataset = pd.read_csv(url)
dataset.to_pickle(filename_pickle)
table = FF.create_table(dataset.head(10))
py.offline.iplot(table) # table is inline inside jupyter notebook
ImportError:
The plotly.grid_objs module is deprecated,
please install the chart-studio package and use the
chart_studio.grid_objs module instead
Looks like the tutorial is for a much older version of plotly.看起来本教程适用于更旧版本的 plotly。 Try:
尝试:
pip install plotly==2.0.1
in your terminal and then rerun the Python code.在您的终端中,然后重新运行 Python 代码。
By referencing the documentation , you can find that do something as seen here:通过参考文档,您可以发现执行如下所示的操作:
import chart_studio
from chart_studio.grid_objs import Column, Grid
It also says to Replace plotly.grid_objs with chart_studio.grid_objs
in the version 4 migration guide .它还说在版本 4 迁移指南
Replace plotly.grid_objs with chart_studio.grid_objs
。 In this case, a version downgrade is not necessary.在这种情况下,不需要版本降级。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.