我试图在pycharm中使用plotly绘制熊猫数据帧数据,但它不起作用。下面是代码片段
import plotly.plotly as py
import pandas as pd
import numpy as np
import cufflinks as cf
cf.go_offline()
df = pd.DataFrame(np.random.randn(100,4),columns='A B C D'.split())
print(df.head())
df.iplot()
当我在pycharm中运行上述代码时,它抛出了错误
plotly.exceptions.PlotlyError: Because you didn't supply a 'file_id' in the call, we're assuming you're trying to snag a figure from a url. You supplied the url, '', we expected it to start with 'https://plot.ly'.
Run help on this function for more information.
不确定这里到底出了什么问题
有人能帮我吗
谢谢
您的代码,实际上是,在Jupyter笔记本中运行良好,并生成以下绘图:
因此,问题归结为您如何在PyCharm中运行代码。Python控制台?也许是伊皮顿?为了让plotly和
iplot()
离线运行,我认为您必须在Jupyter笔记本中运行这个特定的代码段。但是你也可以在PyCharm中这样做您可能需要进行一些额外的安装,但这一点也不难
相关问题 更多 >
编程相关推荐