Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 熊猫图和谷歌Colab_Python_Pandas_Plot_Plotly_Google Colaboratory - Fatal编程技术网

Python 熊猫图和谷歌Colab

Python 熊猫图和谷歌Colab,python,pandas,plot,plotly,google-colaboratory,Python,Pandas,Plot,Plotly,Google Colaboratory,我正在尝试使用plotly作为Google Colab中的后端,从Pandas中进行绘图 import pandas as pd !pip install plotly==4.14.1 df = pd.DataFrame(dict(a=[1,3,2], b=[3,2,1])) df.plot(backend='plotly') fig= df.plot() fig.show() 当我执行上面的代码时,我得到一个错误: ValueError: Could not find plotti

我正在尝试使用plotly作为Google Colab中的后端,从Pandas中进行绘图

import pandas as pd 
!pip install plotly==4.14.1

df = pd.DataFrame(dict(a=[1,3,2], b=[3,2,1])) 
df.plot(backend='plotly') 
fig= df.plot() 
fig.show()
当我执行上面的代码时,我得到一个错误:

ValueError: Could not find plotting backend 'plotly'. Ensure that you've installed the package providing the 'plotly' entrypoint, or that the package has a top-level `.plot` method.
我真的在用!pip需要精心安装,所以我不知道如何修复它。非常感谢您提供有关如何解决此问题的任何帮助

您可以尝试此方法

!pip卸载-y-q绘图;pip安装-q plotly
!pip-y-q;pip安装-q
作为pd进口熊猫
绘声绘色地导入
pd.set_选项('plotting.backend','plotly')
打印(pd.uuu版本uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
def在单元格()中启用绘图:
''在每个单元格中使用此函数在Google Colaboratory中显示绘图。''
进口伊皮顿
从plotly.offline导入初始\u笔记本\u模式
显示(IPython.core.display.HTML(“”)
初始笔记本模式(已连接=错误)
get_ipython().events.register('pre_run_cell',enable_plotly_in_cell)
df=pd.DataFrame({'a':[10,20,30]})
图=df.plot()
图2(图3)