Hello World
Le Bao
Massive Data Institute
October 18-19, 2022
state state_abb ... educ pres_vote
0 Oklahoma OK ... Bachelor's degree Trump
1 Virginia VA ... High school credential Biden
2 California CA ... Some post-high school, no bachelor's Biden
3 Colorado CO ... Graduate degree Trump
4 Texas TX ... Some post-high school, no bachelor's Biden
... ... ... ... ... ...
5739 Iowa IA ... Bachelor's degree Trump
5740 Florida FL ... Some post-high school, no bachelor's Trump
5741 Idaho ID ... Bachelor's degree Trump
5742 California CA ... High school credential Biden
5743 Virginia VA ... Graduate degree Biden
[5744 rows x 10 columns]
Biden 0.554492
Trump 0.445508
Name: pres_vote, dtype: float64
p1 = go.Figure(data=go.Choropleth(
locations=state_counts['state_abb'],
z=state_counts['obs'].astype(float),
locationmode='USA-states',
colorscale='bluyl',
autocolorscale=False,
marker_line_color='black',
colorbar_title="Obs"
))
#### Confine map to US states and update layout
p1.update_layout(
title_text='Number of respondents by states',
geo = dict(
scope='usa',
projection=go.layout.geo.Projection(type = 'albers usa'),
showlakes=True, ),
)
#p1.show()