I am following a tutorials in plotly official website. I am using jupyter notebook. and I got an import error for plot.grid_objs. I am using plotly 4.0. Any suggestion to fix it? Thanks
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
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. Try:
pip install plotly==2.0.1
in your terminal and then rerun the Python code.
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 . In this case, a version downgrade is not necessary.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.