I have created a choropleth map using python, which shows confirmed cases for each state based on latitude and longitude. However, I am unable to input the data that I want from my dataset.
Here is my code that I tried:
import plotly.graph_objects as go
import pandas as pd
df = pd.read_csv("COVID19-DATA-01-ONLYSTATES.csv")
fig = go.Figure(data=go.Choropleth(
locations = df["AdminRegion1"],
z = df["Confirmed"],
locationmode = 'USA-states', # set of locations match entries in `locations`
colorscale = 'Reds',
))
fig.update_layout(
geo_scope='usa',
)
fig.show()
This code is for all countries as provided data suggests and also you didn't mention about it. If you want for specific country, add STATE_CODE in dataframe.(right now, STATE_CODE is missing) check
You need some data preprocessing before plotting raw data into map.
Data Preprocessing:
Plot: