I think the root cause is the information you're trying to plot is not available in world_vaccines
or the CSV (lifeExp
and iso_alpha
).
To remedy this I modified the groupby
statement to include iso_code
and then used that for the location
input and people_vaccinated
as the color
input (although other stats are available).
Here's a working example:
import pandas as pd
import plotly.express as px
df = pd.read_csv('country_vaccinations.csv')
world_vaccines = df.groupby(['iso_code','vaccines'])[['people_vaccinated']].max().reset_index()
fig = px.choropleth(world_vaccines, locations="iso_code",
color="people_vaccinated",
hover_name="iso_code",)
fig.show()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…