This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get all state rows using Area_Name | |
area_name = ['Alabama','Alaska','Arizona', 'Arkansas','California','Colorado','Connecticut','Delaware', | |
'Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana', | |
'Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska', | |
'Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio', | |
'Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas', | |
'Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming'] | |
states = population_data.loc[population_data['Area_Name'].isin(area_name)] | |
states |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state = states["State"] | |
international_2010 = states["INTERNATIONAL_MIG_2010"] | |
international_2011 = states["INTERNATIONAL_MIG_2011"] | |
international_2012 = states["INTERNATIONAL_MIG_2012"] | |
international_2013 = states["INTERNATIONAL_MIG_2013"] | |
international_2014 = states["INTERNATIONAL_MIG_2014"] | |
international_2015 = states["INTERNATIONAL_MIG_2015"] | |
international_2016 = states["INTERNATIONAL_MIG_2016"] | |
international_2017 = states["INTERNATIONAL_MIG_2017"] | |
international_2018 = states["INTERNATIONAL_MIG_2018"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int_migration_graph_2010 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2010", title='International Migration 2010') | |
int_migration_graph_2010.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int_migration_graph_2011 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2011", title='International Migration 2011') | |
int_migration_graph_2011.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int_migration_graph_2012 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2012", title='International Migration 2012') | |
int_migration_graph_2012.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int_migration_graph_2013 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2013", title='International Migration 2013') | |
int_migration_graph_2013.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int_migration_graph_2016 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2016", title='International Migration 2016') | |
int_migration_graph_2016.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int_migration_graph_2018 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2018", title='International Migration 2018') | |
int_migration_graph_2018.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
states['text'] = "International Migration 2018"+"\ | |
"+ states["INTERNATIONAL_MIG_2018"].astype(str) + " " +"State:" +" \ | |
"+ states["Area_Name"] | |
fig = go.Figure(data=go.Choropleth( | |
locations=states['State'], # Spatial coordinates | |
z = states["INTERNATIONAL_MIG_2018"].astype(float), # Data to be color-coded | |
locationmode = 'USA-states', # set of locations match entries in `locations` | |
colorscale = 'reds', | |
text = states['text'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
florida_graph_2018 = px.line(florida, x = 'Area_Name', y = 'INTERNATIONAL_MIG_2018', title = 'Internation Migration Settlement in Florida') | |
florida_graph_2018.show() |
OlderNewer