Hello I am trying to get a map visualization via pyplot but there is an error= PlotlyRequestError: Authentication credentials were not provided. I am trying to visualize Islam-adherence in the world this is my code data frame already there
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")
The thing that I don't understand is why I need to input some kind of username and password I am not trying to log in anywhere. Could you please help me thank you ...
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")
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments