python - 属性错误: module 'plotly.tools' has no attribute 'set_credentials_file'

标签 python plotly

我正在遵循plotly的介绍教程,但在使用Jupyter时遇到了问题。

这是下面的代码:

import numpy as np
import pandas as pd

import cufflinks as cf

import chart_studio.plotly as py

import plotly.tools as tls
import plotly.graph_objs as go

tls.set_credentials_file(username = "xxx", api_key = "yyyy")

以及我收到的错误。

--------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[21], line 1
----> 1 tls.set_credentials_file(username = "xxxx", api_key = "yyy")

AttributeError: module 'plotly.tools' has no attribute 'set_credentials_file'

我在 SO 上看到的所有其他问题都是几年前的,我担心软件包的文档已更新。

有人可以帮忙吗?

最佳答案

正如 @Sotos 在评论中提到的,set_credentials_file 文件在 plotly.tools 中不再可用。

您应该使用chart_studio:https://pypi.org/project/chart-studio/它应该适合你:

import chart_studio.tools as tls

tls.set_credentials_file(username='xxx', api_key='yyyy')

另请查看当前的入门文档:https://plotly.com/python/getting-started-with-chart-studio/ .

关于python - 属性错误: module 'plotly.tools' has no attribute 'set_credentials_file' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76778624/

相关文章:

r - 面积图显示较大的值低于较小的值

r - 使用plotly绘制多个ggplot2图

python - 阴谋冲刺 : Time Series Scatter plot rendering

python - 如何在 Python 中插入 cookie 以进行网络抓取?

python - 将 BlobKey 存储在模型中

python - Python 获取属性值失败

python - 奇怪的python比较行为

python - 在字符串中的数组中查找任何值的出现并打印它

python - plotly 指标数字舍入

python - 在折线/面积图的左右两侧添加填充