Python plotly choropleth map visualization , authentication credentials were not provided error

luthierz

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 ...

Rob Raymond
  • How to fix PlotlyRequestError? you are trying to publish onto chart studio
  • either use
    1. go.Figure(fig)
    2. iplot(fig,filename="ıslam-adherence")
  • have sourced data from kaggle to be able to run your code

data sourcing

# 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"])
)

create and display plot

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")

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Django Rest Framework - Authentication credentials were not provided

Authentication credentials were not provided with djangorestframework-jwt

Authentication credentials were not provided django-rest-auth

DRF API endpoint getting "Authentication credentials were not provided"

Authentication credentials were not provided. when deployed to AWS

django-oauth-toolkit; Django Rest Framework - Authentication credentials were not provided

Plotly world Choropleth Map offline in python?

DRF Token Authentication: { "detail": "Authentication credentials were not provided." }

Permission classess decorator is ignored. "Authentication credentials were not provided" response

Authentication credentials were not provided drf

Auth error with POST request: "Authentication credentials were not provided" using Axios, but works using POSTMAN

{detail: "Authentication credentials were not provided."} on get request with simplejwt

How to customize [Authentication credentials were not provided] error message in Django rest framework

Seafile installation - {"detail":"Authentication credentials were not provided."}

Django : "detail": "Authentication credentials were not provided."

"detail": "Authentication credentials were not provided."

Authentication credentials were not provided with Django Rest Framework JWT

Django Authentication credentials were not provided

"Authentication credentials were not provided." in DRF

Choropleth Map Error (using plotly in python) Using ONS GeoJSON data

Adding caption below Python Plotly Choropleth Map

"detail": "Authentication credentials were not provided." for general views

How to use choropleth map function with python plotly library to visualize by continent?

Python Requests with Django Rest Framework - 'detail': 'Authentication credentials were not provided'

How to add static text in map using Plotly Choropleth Python

Voice Recording - Authentication Error - No credentials provided

How to solve "detail": "Authentication credentials were not provided." error for Class-based APIView Django REST Framework?

How to solve the error "Authentication credentials were not provided" while running a CURL get request in php?

Choropleth map plotly python