Learn practical skills, build real-world projects, and advance your career
Created 4 years ago
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://gist.githubusercontent.com/shinokada/f01139d3a024de375ede23cec5d52360/raw/424ac0055ed71a04e6f45badfaef73df96ad0aad/CrimeStatebyState_1960-2014.csv')
df = df[(df['State']!= 'District of Columbia' )]
df
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://gist.githubusercontent.com/shinokada/f01139d3a024de375ede23cec5d52360/raw/424ac0055ed71a04e6f45badfaef73df96ad0aad/CrimeStatebyState_1960-2014.csv')
df = df[(df['State']!= 'District of Columbia' )]
px.choropleth(df,
locations = 'State_code',
color="Murder_per100000",
animation_frame="Year",
color_continuous_scale="Inferno",
locationmode='USA-states',
scope="usa",
range_color=(0, 20),
title='Crime by State',
height=600
)
import plotly.express as px
gapminder = px.data.gapminder()
display(gapminder)
# Animated_choropleth_world_map.py
import plotly.express as px
gapminder = px.data.gapminder()
px.choropleth(gapminder,
locations="iso_alpha",
color="lifeExp",
hover_name="country",
animation_frame="year",
color_continuous_scale='Plasma',
height=600
)