你好,我正试图通过pyplot获得一个地图可视化,但是没有提供error= PlotlyRequestError:身份验证凭据。我正试图想象伊斯兰教在世界上的遵守-这是我的代码数据框架已经在那里。
from chart_studio import plotly as py
import plotly.tools as tls
data = [dict(type='choropleth',autocolorscale=False,locations=df['name'],z=df['islam'],locationmode="ISO-3",text="test",colorbar= dict(title="heyyo"))]
layout= dict(title="Islam adherence in the world ")
fig= dict(data=data, layout=layout)
py.iplot(fig,filename="ıslam-adherence")
fig= dict(data=data, layout=layout)
py.iplot(fig,filename="ıslam-adherence")我不明白的是,为什么我需要输入某种用户名和密码,我不想在任何地方登录。你能帮帮我吗谢谢..。
发布于 2021-09-03 15:15:05
您想要发布到图表工作室的
go.Figure(fig)数据来源
# https://www.kaggle.com/arthurtok/global-religion-1945-2010-plotly-pandas-visuals
import kaggle.cli
import sys, math
import pandas as pd
from pathlib import Path
from zipfile import ZipFile
import plotly.express as px
# download data set
# https://www.kaggle.com/umichigan/world-religions
sys.argv = [sys.argv[0]] + "datasets download umichigan/world-religions".split(" ")
kaggle.cli.main()
zfile = ZipFile("world-religions.zip")
print([f.filename for f in zfile.infolist()])
dfs = {f.filename: pd.read_csv(zfile.open(f)) for f in zfile.infolist()}
df = (
dfs["national.csv"]
.sort_values(["code", "year"])
.groupby("code", as_index=False)
.last()
.assign(islam=lambda d: d["islam_percent"], name=lambda d: d["code"])
)创建和显示绘图
from chart_studio import plotly as py
import plotly.graph_objects as go
import plotly.tools as tls
data = [
dict(
type="choropleth",
autocolorscale=False,
locations=df["name"],
z=df["islam"],
locationmode="ISO-3",
text=df["year"],
colorbar=dict(title="heyyo"),
)
]
layout = dict(title="Islam adherence in the world ")
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()
fig = dict(data=data, layout=layout)
iplot(fig,filename="ıslam-adherence")

https://stackoverflow.com/questions/69020390
复制相似问题