ImportError: The plotly.plotly module is deprecated,please install the chart-studio

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ImportError: The plotly.plotly module is deprecated,please install the chart-studio相关的知识,希望对你有一定的参考价值。

ImportError: The plotly.plotly module is deprecated,please install the chart-studio package and use the chart_studio.plotly module instead. 

问题:

plotly原有api过期了

import plotly.plotly as py
import cufflinks as cf
import pandas as pd

cf.set_config_file(offline=True, theme='ggplot')


N = 500
x = np.linspace(0, 1, N)
y = np.random.randn(N)
df = pd.DataFrame({'x': x, 'y': y})
df.set_index('x',inplace=True)

df.iplot(kind='scatter', filename='tmp/cf_line.html')


解决:

#安装

pip install chart-studio

#导入

from chart_studio import plotly

from chart_studio import plotly as py
import cufflinks as cf
import pandas as pd
import numpy as np

cf.set_config_file(offline=True, theme='ggplot')


N = 500
x = np.linspace(0, 1, N)
y = np.random.randn(N)
df = pd.DataFrame({'x': x, 'y': y})
df.set_index('x',inplace=True)

df.iplot(kind='scatter', filename='cf_line.html')

完整错误日志

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-235d2cc141ff> in <module>
----> 1 import plotly.plotly as py
      2 import cufflinks as cf
      3 import pandas as pd
      4 
      5 cf.set_config_file(offline=True, theme='ggplot')

D:\\anaconda\\lib\\site-packages\\plotly\\plotly\\__init__.py in <module>
      2 from _plotly_future_ import _chart_studio_error
      3 
----> 4 _chart_studio_error("plotly")

D:\\anaconda\\lib\\site-packages\\_plotly_future_\\__init__.py in _chart_studio_error(submodule)
     47 chart_studio.{submodule} module instead.
     48 """.format(
---> 49             submodule=submodule
     50         )
     51     )

ImportError: 
The plotly.plotly module is deprecated,
please install the chart-studio package and use the
chart_studio.plotly module instead. 

参考:How do I fix a deprecated module for plotly.plotly

以上是关于ImportError: The plotly.plotly module is deprecated,please install the chart-studio的主要内容,如果未能解决你的问题,请参考以下文章

尝试导入 sklearn 模块时出错:ImportError: DLL load failed: The specified module could not be found

ImportError: The _imagingft C module is not installed

centos下安装pillow报ImportError: The _imagingft C module is not installed的解决方案

“ ImportError: DLL load failed: The specified procedure could not be found”- 使用 Keras 在 Python 中使用 C

ImportError: DLL load failed: The specified module could not be found -- IBM DB2

使用 cx_Freeze 时出现“ImportError: DLL load failed: The specified module could not be found”,即使添加了 tcl86t