In [55]:
from matplotlib.pyplot import figure
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from pandas import DataFrame
from plotly.subplots import make_subplots
import pandas as pd 
import numpy as np
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go
import plotly.figure_factory as ff
%matplotlib inline
In [56]:
#Read csv file and load to population data  data frame
population_data = pd.read_csv("/home/emma/data_science_projects/pop_ds_proj/population_estimates.csv")
In [57]:
population_data.head()
Out[57]:
1 FIPS State Area_Name Rural-urban_Continuum Code_2003 Rural-urban_Continuum Code_2013 Urban_Influence_Code_2003 Urban_Influence_Code_2013 Economic_typology_2015 CENSUS_2010_POP ... R_DOMESTIC_MIG_2017 R_DOMESTIC_MIG_2018 R_NET_MIG_2011 R_NET_MIG_2012 R_NET_MIG_2013 R_NET_MIG_2014 R_NET_MIG_2015 R_NET_MIG_2016 R_NET_MIG_2017 R_NET_MIG_2018
0 2 0 US United States NaN NaN NaN NaN NaN 308745538 ... NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1 3 1000 AL Alabama NaN NaN NaN NaN NaN 4779736 ... 0.424031 1.171362 0.516888 1.234191 1.607294 0.619874 0.646064 0.817666 1.079070 1.856398
2 4 1001 AL Autauga County 2.0 2.0 2.0 2.0 0.0 54571 ... 1.066088 0.666403 6.002073 -6.119262 -3.885124 1.971001 -1.859380 5.250727 1.029950 0.630381
3 5 1003 AL Baldwin County 4.0 3.0 5.0 2.0 5.0 182265 ... 21.996950 24.298662 16.345147 17.638173 22.876199 20.239802 17.932091 21.484903 22.534622 24.846682
4 6 1005 AL Barbour County 6.0 6.0 6.0 6.0 3.0 27457 ... -25.501697 -9.072923 0.256035 -6.786002 -8.093425 -5.102231 -15.531931 -18.152860 -25.030896 -8.593297

5 rows × 150 columns

In [58]:
population_data.apply(lambda x: sum(x.isnull()), axis=0)
Out[58]:
1                                    0
FIPS                                 0
State                                0
Area_Name                            0
Rural-urban_Continuum Code_2003     58
Rural-urban_Continuum Code_2013     53
Urban_Influence_Code_2003           58
Urban_Influence_Code_2013           53
Economic_typology_2015             131
CENSUS_2010_POP                      0
ESTIMATES_BASE_2010                  0
POP_ESTIMATE_2010                    0
POP_ESTIMATE_2011                    0
POP_ESTIMATE_2012                    0
POP_ESTIMATE_2013                    0
POP_ESTIMATE_2014                    0
POP_ESTIMATE_2015                    0
POP_ESTIMATE_2016                    0
POP_ESTIMATE_2017                    0
POP_ESTIMATE_2018                    0
N_POP_CHG_2010                      79
N_POP_CHG_2011                      79
N_POP_CHG_2012                      79
N_POP_CHG_2013                      79
N_POP_CHG_2014                      79
N_POP_CHG_2015                      79
N_POP_CHG_2016                      79
N_POP_CHG_2017                      79
N_POP_CHG_2018                      79
Births_2010                         79
                                  ... 
R_NATURAL_INC_2013                  80
R_NATURAL_INC_2014                  80
R_NATURAL_INC_2015                  80
R_NATURAL_INC_2016                  80
R_NATURAL_INC_2017                  80
R_NATURAL_INC_2018                  80
R_INTERNATIONAL_MIG_2011            80
R_INTERNATIONAL_MIG_2012            80
R_INTERNATIONAL_MIG_2013            80
R_INTERNATIONAL_MIG_2014            80
R_INTERNATIONAL_MIG_2015            80
R_INTERNATIONAL_MIG_2016            80
R_INTERNATIONAL_MIG_2017            80
R_INTERNATIONAL_MIG_2018            80
R_DOMESTIC_MIG_2011                 80
R_DOMESTIC_MIG_2012                 80
R_DOMESTIC_MIG_2013                 80
R_DOMESTIC_MIG_2014                 80
R_DOMESTIC_MIG_2015                 80
R_DOMESTIC_MIG_2016                 80
R_DOMESTIC_MIG_2017                 80
R_DOMESTIC_MIG_2018                 80
R_NET_MIG_2011                      80
R_NET_MIG_2012                      80
R_NET_MIG_2013                      80
R_NET_MIG_2014                      80
R_NET_MIG_2015                      80
R_NET_MIG_2016                      80
R_NET_MIG_2017                      80
R_NET_MIG_2018                      80
Length: 150, dtype: int64
In [59]:
list(population_data)
Out[59]:
['1',
 'FIPS',
 'State',
 'Area_Name',
 'Rural-urban_Continuum Code_2003',
 'Rural-urban_Continuum Code_2013',
 'Urban_Influence_Code_2003',
 'Urban_Influence_Code_2013',
 'Economic_typology_2015',
 'CENSUS_2010_POP',
 'ESTIMATES_BASE_2010',
 'POP_ESTIMATE_2010',
 'POP_ESTIMATE_2011',
 'POP_ESTIMATE_2012',
 'POP_ESTIMATE_2013',
 'POP_ESTIMATE_2014',
 'POP_ESTIMATE_2015',
 'POP_ESTIMATE_2016',
 'POP_ESTIMATE_2017',
 'POP_ESTIMATE_2018',
 'N_POP_CHG_2010',
 'N_POP_CHG_2011',
 'N_POP_CHG_2012',
 'N_POP_CHG_2013',
 'N_POP_CHG_2014',
 'N_POP_CHG_2015',
 'N_POP_CHG_2016',
 'N_POP_CHG_2017',
 'N_POP_CHG_2018',
 'Births_2010',
 'Births_2011',
 'Births_2012',
 'Births_2013',
 'Births_2014',
 'Births_2015',
 'Births_2016',
 'Births_2017',
 'Births_2018',
 'Deaths_2010',
 'Deaths_2011',
 'Deaths_2012',
 'Deaths_2013',
 'Deaths_2014',
 'Deaths_2015',
 'Deaths_2016',
 'Deaths_2017',
 'Deaths_2018',
 'NATURAL_INC_2010',
 'NATURAL_INC_2011',
 'NATURAL_INC_2012',
 'NATURAL_INC_2013',
 'NATURAL_INC_2014',
 'NATURAL_INC_2015',
 'NATURAL_INC_2016',
 'NATURAL_INC_2017',
 'NATURAL_INC_2018',
 'INTERNATIONAL_MIG_2010',
 'INTERNATIONAL_MIG_2011',
 'INTERNATIONAL_MIG_2012',
 'INTERNATIONAL_MIG_2013',
 'INTERNATIONAL_MIG_2014',
 'INTERNATIONAL_MIG_2015',
 'INTERNATIONAL_MIG_2016',
 'INTERNATIONAL_MIG_2017',
 'INTERNATIONAL_MIG_2018',
 'DOMESTIC_MIG_2010',
 'DOMESTIC_MIG_2011',
 'DOMESTIC_MIG_2012',
 'DOMESTIC_MIG_2013',
 'DOMESTIC_MIG_2014',
 'DOMESTIC_MIG_2015',
 'DOMESTIC_MIG_2016',
 'DOMESTIC_MIG_2017',
 'DOMESTIC_MIG_2018',
 'NET_MIG_2010',
 'NET_MIG_2011',
 'NET_MIG_2012',
 'NET_MIG_2013',
 'NET_MIG_2014',
 'NET_MIG_2015',
 'NET_MIG_2016',
 'NET_MIG_2017',
 'NET_MIG_2018',
 'RESIDUAL_2010',
 'RESIDUAL_2011',
 'RESIDUAL_2012',
 'RESIDUAL_2013',
 'RESIDUAL_2014',
 'RESIDUAL_2015',
 'RESIDUAL_2016',
 'RESIDUAL_2017',
 'RESIDUAL_2018',
 'GQ_ESTIMATES_BASE_2010',
 'GQ_ESTIMATES_2010',
 'GQ_ESTIMATES_2011',
 'GQ_ESTIMATES_2012',
 'GQ_ESTIMATES_2013',
 'GQ_ESTIMATES_2014',
 'GQ_ESTIMATES_2015',
 'GQ_ESTIMATES_2016',
 'GQ_ESTIMATES_2017',
 'GQ_ESTIMATES_2018',
 'R_birth_2011',
 'R_birth_2012',
 'R_birth_2013',
 'R_birth_2014',
 'R_birth_2015',
 'R_birth_2016',
 'R_birth_2017',
 'R_birth_2018',
 'R_death_2011',
 'R_death_2012',
 'R_death_2013',
 'R_death_2014',
 'R_death_2015',
 'R_death_2016',
 'R_death_2017',
 'R_death_2018',
 'R_NATURAL_INC_2011',
 'R_NATURAL_INC_2012',
 'R_NATURAL_INC_2013',
 'R_NATURAL_INC_2014',
 'R_NATURAL_INC_2015',
 'R_NATURAL_INC_2016',
 'R_NATURAL_INC_2017',
 'R_NATURAL_INC_2018',
 'R_INTERNATIONAL_MIG_2011',
 'R_INTERNATIONAL_MIG_2012',
 'R_INTERNATIONAL_MIG_2013',
 'R_INTERNATIONAL_MIG_2014',
 'R_INTERNATIONAL_MIG_2015',
 'R_INTERNATIONAL_MIG_2016',
 'R_INTERNATIONAL_MIG_2017',
 'R_INTERNATIONAL_MIG_2018',
 'R_DOMESTIC_MIG_2011',
 'R_DOMESTIC_MIG_2012',
 'R_DOMESTIC_MIG_2013',
 'R_DOMESTIC_MIG_2014',
 'R_DOMESTIC_MIG_2015',
 'R_DOMESTIC_MIG_2016',
 'R_DOMESTIC_MIG_2017',
 'R_DOMESTIC_MIG_2018',
 'R_NET_MIG_2011',
 'R_NET_MIG_2012',
 'R_NET_MIG_2013',
 'R_NET_MIG_2014',
 'R_NET_MIG_2015',
 'R_NET_MIG_2016',
 'R_NET_MIG_2017',
 'R_NET_MIG_2018']
In [60]:
population_data.describe()
Out[60]:
1 FIPS Rural-urban_Continuum Code_2003 Rural-urban_Continuum Code_2013 Urban_Influence_Code_2003 Urban_Influence_Code_2013 Economic_typology_2015 CENSUS_2010_POP ESTIMATES_BASE_2010 POP_ESTIMATE_2010 ... R_DOMESTIC_MIG_2017 R_DOMESTIC_MIG_2018 R_NET_MIG_2011 R_NET_MIG_2012 R_NET_MIG_2013 R_NET_MIG_2014 R_NET_MIG_2015 R_NET_MIG_2016 R_NET_MIG_2017 R_NET_MIG_2018
count 3273.000000 3273.000000 3215.000000 3220.000000 3215.000000 3220.000000 3142.000000 3.273000e+03 3.273000e+03 3.273000e+03 ... 3193.000000 3193.000000 3193.000000 3193.000000 3193.000000 3193.000000 3193.000000 3193.000000 3193.000000 3193.000000
mean 1638.000000 31358.511763 5.053810 4.937888 5.366096 5.188820 1.808402 2.852679e+05 2.852816e+05 2.857994e+05 ... -0.138742 -0.005717 -0.965694 -1.578025 -0.601590 -0.788958 -0.408385 -0.043331 0.987453 1.137715
std 944.978042 16305.188962 2.701246 2.724344 3.481577 3.506848 1.819511 5.517452e+06 5.517676e+06 5.527848e+06 ... 12.929942 11.399481 10.446482 11.854254 11.813969 11.151401 12.459689 13.074531 12.874621 11.318970
min 2.000000 0.000000 1.000000 1.000000 1.000000 1.000000 0.000000 8.200000e+01 8.200000e+01 8.400000e+01 ... -68.755498 -62.267715 -128.205128 -99.447514 -98.755187 -174.358974 -75.518089 -108.154101 -68.349462 -62.145860
25% 820.000000 19025.000000 3.000000 2.000000 2.000000 2.000000 0.000000 1.156100e+04 1.157800e+04 1.155600e+04 ... -6.542629 -6.146014 -5.829574 -6.909274 -5.891276 -6.176610 -5.981444 -6.042211 -5.332640 -5.006258
50% 1638.000000 30021.000000 6.000000 6.000000 5.000000 5.000000 1.000000 2.694800e+04 2.692900e+04 2.685200e+04 ... -0.484198 -0.518668 -0.917066 -1.736808 -1.002234 -1.090096 -0.954198 -0.604266 0.528755 0.555717
75% 2456.000000 46101.000000 7.000000 7.000000 8.000000 8.000000 3.000000 7.031100e+04 7.040500e+04 7.056200e+04 ... 6.670177 5.946850 3.710145 3.504348 4.354136 4.347826 5.010005 5.873749 7.523993 6.833433
max 3274.000000 72153.000000 9.000000 9.000000 12.000000 12.000000 5.000000 3.087455e+08 3.087581e+08 3.093261e+08 ... 150.197628 69.444444 122.905028 120.152193 208.333333 150.328411 278.846154 209.666667 150.197628 69.444444

8 rows × 148 columns

In [61]:
#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
Out[61]:
1 FIPS State Area_Name Rural-urban_Continuum Code_2003 Rural-urban_Continuum Code_2013 Urban_Influence_Code_2003 Urban_Influence_Code_2013 Economic_typology_2015 CENSUS_2010_POP ... R_DOMESTIC_MIG_2017 R_DOMESTIC_MIG_2018 R_NET_MIG_2011 R_NET_MIG_2012 R_NET_MIG_2013 R_NET_MIG_2014 R_NET_MIG_2015 R_NET_MIG_2016 R_NET_MIG_2017 R_NET_MIG_2018
1 3 1000 AL Alabama NaN NaN NaN NaN NaN 4779736 ... 0.424031 1.171362 0.516888 1.234191 1.607294 0.619874 0.646064 0.817666 1.079070 1.856398
69 71 2000 AK Alaska NaN NaN NaN NaN NaN 710231 ... -14.508975 -14.557034 0.474949 1.496795 -0.903612 -11.375421 -7.968225 -3.911968 -11.005272 -11.306342
99 101 4000 AZ Arizona NaN NaN NaN NaN NaN 6392017 ... 8.993644 11.707025 4.302215 7.038612 6.464858 9.347708 9.662843 12.020279 11.029897 13.723125
115 117 5000 AR Arkansas NaN NaN NaN NaN NaN 2915918 ... 1.335801 0.822693 3.145819 0.916417 0.114350 -0.039479 1.093820 1.534978 2.063267 1.573921
191 193 6000 CA California NaN NaN NaN NaN NaN 37253956 ... -3.501098 -3.953271 1.376097 1.699095 1.847889 2.402701 2.159548 0.670554 -0.454811 -0.969421
250 252 8000 CO Colorado NaN NaN NaN NaN NaN 5029196 ... 6.747978 7.654711 7.654828 7.621159 8.582211 9.070676 12.959158 10.676585 8.262209 9.105805
315 317 9000 CT Connecticut NaN NaN NaN NaN NaN 3574097 ... -6.613582 -6.019412 0.190871 -0.377867 -1.601823 -1.885476 -3.723602 -4.106231 -2.571948 -1.403475
324 326 10000 DE Delaware NaN NaN NaN NaN NaN 897934 ... 4.689728 7.127976 4.801565 4.910826 6.209397 6.493793 6.755571 5.516683 6.460703 9.019623
330 332 12000 FL Florida NaN NaN NaN NaN NaN 18801310 ... 7.863860 6.273137 10.947429 9.959869 10.530480 13.056427 16.507396 18.307039 15.662009 14.583736
398 400 13000 GA Georgia NaN NaN NaN NaN NaN 9687653 ... 3.898866 4.004676 2.817040 3.813009 1.740393 4.064698 5.807178 7.121981 5.986441 6.086221
558 560 15000 HI Hawaii NaN NaN NaN NaN NaN 1360301 ... -9.923893 -8.739077 4.647831 5.179231 3.565724 -1.238261 0.391211 -1.231324 -6.613592 -5.874094
564 566 16000 ID Idaho NaN NaN NaN NaN NaN 1567582 ... 14.540392 13.875164 1.191910 0.651093 3.461210 6.083856 6.002433 13.194368 15.536325 14.843172
609 611 17000 IL Illinois NaN NaN NaN NaN NaN 12830632 ... -8.955499 -8.943688 -2.675348 -3.261336 -3.020046 -5.004337 -5.950537 -6.826452 -6.571093 -6.535676
712 714 18000 IN Indiana NaN NaN NaN NaN NaN 6483802 ... -0.246588 0.532506 0.035367 -0.404177 1.278498 0.318343 -0.927902 0.568359 1.117545 1.914625
805 807 19000 IA Iowa NaN NaN NaN NaN NaN 3046355 ... -1.278002 -0.916222 1.843768 -0.120479 2.359797 1.925327 0.702299 0.036461 0.573348 0.934001
905 907 20000 KS Kansas NaN NaN NaN NaN NaN 2853118 ... -5.063937 -4.315899 -1.441879 0.569304 -2.070993 -2.206266 -1.284249 -3.630107 -4.285161 -3.609292
1011 1013 21000 KY Kentucky NaN NaN NaN NaN NaN 4339367 ... 0.365943 0.178878 1.947994 1.030395 1.562699 -0.483258 0.476897 0.774800 1.698136 1.482581
1132 1134 22000 LA Louisiana NaN NaN NaN NaN NaN 4533372 ... -5.873976 -5.983198 1.919577 0.851134 1.030200 -0.212757 0.057364 -1.468255 -5.218508 -5.337594
1197 1199 23000 ME Maine NaN NaN NaN NaN NaN 1328361 ... 3.517808 3.343224 0.774160 -0.262817 0.872778 2.531821 -0.488109 3.352064 3.952096 3.769637
1214 1216 24000 MD Maryland NaN NaN NaN NaN NaN 5773552 ... -3.991992 -4.063440 3.600733 3.315179 1.775836 1.160255 0.315784 -1.352135 -0.208652 -0.322019
1239 1241 25000 MA Massachusetts NaN NaN NaN NaN NaN 6547629 ... -3.629705 -3.741992 4.277830 4.658374 5.101553 4.970471 2.704516 2.172969 3.626783 3.960366
1254 1256 26000 MI Michigan NaN NaN NaN NaN NaN 9883640 ... -1.306782 -1.678920 -2.061435 -0.849915 -0.452896 -0.497986 -1.506507 0.103498 0.842519 0.465543
1338 1340 27000 MN Minnesota NaN NaN NaN NaN NaN 5303925 ... 1.370050 1.210984 1.244122 0.452332 1.825538 1.725691 0.855495 2.536818 3.311345 3.128451
1426 1428 28000 MS Mississippi NaN NaN NaN NaN NaN 2967297 ... -2.464720 -3.620365 -0.969910 -1.797312 -0.971442 -2.115590 -3.017068 -2.352020 -1.590843 -2.700381
1509 1511 29000 MO Missouri NaN NaN NaN NaN NaN 5988927 ... -0.146444 -0.456066 -1.079162 -0.837978 -0.124163 -0.433002 0.122196 -0.018916 1.193196 0.864237
1625 1627 30000 MT Montana NaN NaN NaN NaN NaN 989415 ... 8.317283 5.660409 3.635919 3.420333 6.952796 5.174273 5.520383 7.576643 9.207465 6.500914
1682 1684 31000 NE Nebraska NaN NaN NaN NaN NaN 1826341 ... -1.856938 -1.722971 0.502442 1.255597 1.240744 1.831807 0.955177 2.106161 0.623513 0.723190
1776 1778 32000 NV Nevada NaN NaN NaN NaN NaN 2700551 ... 12.845507 15.847381 -1.876917 6.341888 6.722040 9.912823 12.513015 13.140333 13.898089 16.879545
1794 1796 33000 NH New Hampshire NaN NaN NaN NaN NaN 1316470 ... 3.519876 2.902937 0.650082 1.826175 0.627082 4.349476 2.058050 4.173718 5.412794 4.828867
1805 1807 34000 NJ New Jersey NaN NaN NaN NaN NaN 8791894 ... -6.422317 -5.685320 -0.851628 -1.996122 -2.042946 -2.771431 -3.013477 -3.177277 -1.338621 -0.441758
1827 1829 35000 NM New Mexico NaN NaN NaN NaN NaN 2059179 ... -3.589904 -2.793625 2.135111 -1.607027 -2.267279 -5.617798 -4.072667 -2.148219 -2.476719 -1.675411
1861 1863 36000 NY New York NaN NaN NaN NaN NaN 19378102 ... -9.613760 -9.215053 0.281810 -0.850458 -1.696265 -3.046453 -4.102525 -5.306516 -6.149829 -5.618338
1924 1926 37000 NC North Carolina NaN NaN NaN NaN NaN 9535483 ... 6.343906 6.486844 4.238251 5.322202 6.002841 5.360828 6.644556 9.088271 8.364713 8.426865
2025 2027 38000 ND North Dakota NaN NaN NaN NaN NaN 672591 ... -9.270441 -3.140070 10.395295 16.891590 23.100031 14.140242 15.303700 -6.467888 -5.747488 0.287741
2079 2081 39000 OH Ohio NaN NaN NaN NaN NaN 11536504 ... -0.698138 -1.040184 -1.999325 -1.820990 0.365060 -0.030544 -0.494039 -0.313424 0.968963 0.716636
2168 2170 40000 OK Oklahoma NaN NaN NaN NaN NaN 3751351 ... -2.664831 -1.136150 3.534437 4.021339 5.128910 2.797103 4.553557 0.875635 -1.543628 -0.051297
2246 2248 41000 OR Oregon NaN NaN NaN NaN NaN 3831074 ... 9.101728 6.433494 5.535940 3.993388 3.139084 7.452757 10.566313 15.790443 11.084492 8.395039
2283 2285 42000 PA Pennsylvania NaN NaN NaN NaN NaN 12702379 ... -2.144836 -1.598828 1.516750 0.547598 -0.023724 -0.133225 -0.921843 -0.952470 0.302260 1.165270
2351 2353 44000 RI Rhode Island NaN NaN NaN NaN NaN 1052567 ... -3.698045 -2.496924 -1.579142 -0.554992 -0.644634 -0.036947 -0.570024 -0.158051 -1.417521 0.109755
2357 2359 45000 SC South Carolina NaN NaN NaN NaN NaN 4625364 ... 9.940424 10.049136 4.314351 6.360098 7.330245 9.634806 11.613160 11.229291 11.083973 11.135690
2404 2406 46000 SD South Dakota NaN NaN NaN NaN NaN 814180 ... 2.310826 0.726850 3.425123 6.593924 4.686812 1.746526 0.450963 5.153705 6.547723 4.895413
2471 2473 47000 TN Tennessee NaN NaN NaN NaN NaN 6346105 ... 6.271621 5.928122 3.716700 5.283651 3.860572 4.629646 5.196002 5.975150 7.625991 7.262662
2567 2569 48000 TX Texas NaN NaN NaN NaN NaN 25145561 ... 2.943501 2.895910 7.428220 8.960596 7.299100 10.147119 10.783058 8.595399 6.606197 6.577692
2822 2824 49000 UT Utah NaN NaN NaN NaN NaN 2763885 ... 5.974554 5.124977 0.753549 1.539253 3.122373 1.752430 3.901420 9.042822 8.894629 7.987902
2852 2854 50000 VT Vermont NaN NaN NaN NaN NaN 625741 ... -1.365200 -0.099135 0.833294 -2.405346 -0.332195 -2.285386 -0.025592 -2.488708 1.554277 2.858915
2867 2869 51000 VA Virginia NaN NaN NaN NaN NaN 8001024 ... -1.479603 -1.157753 4.303607 5.158146 3.502921 2.265120 1.551666 1.274007 2.376845 2.568467
3001 3003 53000 WA Washington NaN NaN NaN NaN NaN 6724540 ... 8.785531 6.222703 6.178750 4.988577 4.920545 7.646476 10.698382 13.260274 13.025173 10.307584
3041 3043 54000 WV West Virginia NaN NaN NaN NaN NaN 1852994 ... -5.541153 -3.880338 1.815492 0.872648 -0.803097 -1.759493 -2.557793 -4.361102 -5.359135 -3.667248
3097 3099 55000 WI Wisconsin NaN NaN NaN NaN NaN 5686986 ... -0.573800 -0.174226 -0.843686 -0.765190 0.108233 -0.392726 -1.057900 -0.648150 0.720276 1.213205
3170 3172 56000 WY Wyoming NaN NaN NaN NaN NaN 563626 ... -14.693645 -6.373463 -0.501897 10.158339 4.948234 -4.758425 0.294466 -7.145556 -13.624203 -5.341190

50 rows × 150 columns

In [62]:
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"]

trace0 = go.Scatter(
    x = state,
    y = international_2010,
    mode = "lines",
    name = "International Migration 2010"
)

trace1 = go.Scatter(
    x = state,
    y = international_2011,
    mode = "lines",
    name = "International Migration 2011"
)

trace2 = go.Scatter(
    x = state,
    y = international_2012,
    mode = "lines",
    name = "International Migration 2012"
)

trace3 = go.Scatter(
    x = state,
    y = international_2013,
    mode = "lines",
    name = "International Migration 2013"
)

trace4 = go.Scatter(
    x = state,
    y = international_2014,
    mode = "lines",
    name = "International Migration 2014"
)

trace5 = go.Scatter(
    x = state,
    y = international_2015,
    mode = "lines",
    name = "International Migration 2015"
)

trace6 = go.Scatter(
    x = state,
    y = international_2016,
    mode = "lines",
    name = "International Migration 2016"
)

trace7 = go.Scatter(
    x = state,
    y = international_2017,
    mode = "lines",
    name = "International Migration 2017"
)

trace8 = go.Scatter(
    x = state,
    y = international_2018,
    mode = "lines",
    name = "International Migration 2018"
)
In [63]:
data = [trace0,trace1, trace2, trace3, trace4,trace5, trace6, trace7,trace8]
In [64]:
layout = go.Layout(
    title = "International Migration 2010 - 2018",
     xaxis=dict(
        title='US States',
        tickmode='linear'),
     yaxis=dict(
        title='Internation Migration')
        
)
fig = go.Figure(data = data, layout = layout)
fig.show()
In [65]:
int_migration_graph_2018 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2018", title='International Migration 2018')
int_migration_graph_2018.show()
In [66]:
int_migration_graph_2017 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2017", title='International Migration 2017')
int_migration_graph_2017.show()
In [67]:
int_migration_graph_2016 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2016", title='International Migration 2016')
int_migration_graph_2016.show()
In [68]:
int_migration_graph_2015 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2015", title='International Migration 2015')
int_migration_graph_2015.show()
In [69]:
int_migration_graph_2014 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2014", title='International Migration 2014')
int_migration_graph_2014.show()
In [70]:
int_migration_graph_2013 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2013", title='International Migration 2013')
int_migration_graph_2013.show()
In [71]:
int_migration_graph_2012 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2012", title='International Migration 2012')
int_migration_graph_2012.show()
In [72]:
int_migration_graph_2011 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2011", title='International Migration 2011')
int_migration_graph_2011.show()
In [73]:
int_migration_graph_2010 = px.line(states, x = 'State', y = "INTERNATIONAL_MIG_2010", title='International Migration 2010')
int_migration_graph_2010.show()
In [74]:
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'],
    colorbar_title = "International Migration",
))


fig.update_layout(
    title_text= "International Migration 2018",
    geo = dict(
        scope='usa',
        projection=go.layout.geo.Projection(type = 'albers usa'),
        showlakes=True, # lakes
        lakecolor='rgb(255,255,255)'),
)

fig.show()

So let's see where exactly international Migrants settle in Florida

In [75]:
florida = population_data.loc[population_data['State']== 'FL']
florida
# population_data
Out[75]:
1 FIPS State Area_Name Rural-urban_Continuum Code_2003 Rural-urban_Continuum Code_2013 Urban_Influence_Code_2003 Urban_Influence_Code_2013 Economic_typology_2015 CENSUS_2010_POP ... R_DOMESTIC_MIG_2017 R_DOMESTIC_MIG_2018 R_NET_MIG_2011 R_NET_MIG_2012 R_NET_MIG_2013 R_NET_MIG_2014 R_NET_MIG_2015 R_NET_MIG_2016 R_NET_MIG_2017 R_NET_MIG_2018
330 332 12000 FL Florida NaN NaN NaN NaN NaN 18801310 ... 7.863860 6.273137 10.947429 9.959869 10.530480 13.056427 16.507396 18.307039 15.662009 14.583736
331 333 12001 FL Alachua County 3.0 2.0 2.0 2.0 4.0 247336 ... 0.376572 2.362252 4.656034 1.583822 -0.226186 7.795322 10.220022 15.588465 6.518460 8.685187
332 334 12003 FL Baker County 1.0 1.0 1.0 1.0 4.0 27115 ... 9.054936 2.156048 -5.618704 -4.141246 -4.181468 -2.254291 5.838183 14.885102 9.304481 2.403464
333 335 12005 FL Bay County 3.0 3.0 2.0 2.0 5.0 168852 ... -0.364695 3.000003 -0.879715 8.772598 13.292720 18.316233 14.568019 8.207889 1.943227 5.328525
334 336 12007 FL Bradford County 6.0 6.0 6.0 4.0 0.0 28520 ... 16.113163 23.475804 -5.195899 -54.144662 -10.324593 -9.333533 7.092465 -0.336581 16.335926 23.767429
335 337 12009 FL Brevard County 2.0 2.0 2.0 2.0 0.0 543376 ... 20.126921 15.053404 2.892609 6.812078 8.871124 11.863769 21.535499 22.955752 22.805363 18.062397
336 338 12011 FL Broward County 1.0 1.0 1.0 1.0 0.0 1748066 ... -2.948968 -5.320492 15.402613 11.451518 8.808876 9.111415 8.941446 10.529641 7.739676 5.613873
337 339 12013 FL Calhoun County 6.0 6.0 7.0 6.0 4.0 14625 ... 8.828334 12.196803 6.879875 -4.357002 -4.445964 -8.198980 -0.554362 -1.948165 9.036877 12.403528
338 340 12015 FL Charlotte County 3.0 3.0 2.0 2.0 5.0 159978 ... 28.068886 26.300353 7.881946 24.730316 19.710301 28.001406 33.960624 38.702418 30.100846 28.368369
339 341 12017 FL Citrus County 4.0 3.0 5.0 2.0 0.0 141236 ... 27.930171 26.274447 -1.238756 4.890098 7.784033 10.012137 21.436964 28.217163 28.422608 26.778807
340 342 12019 FL Clay County 1.0 1.0 1.0 1.0 0.0 190865 ... 19.893950 14.328113 1.157118 5.076221 6.655010 12.059348 16.530410 21.106698 21.911002 16.401673
341 343 12021 FL Collier County 2.0 2.0 2.0 2.0 5.0 321520 ... 11.923708 10.111436 14.167360 13.417001 19.480384 22.931536 24.462884 25.254625 19.674931 17.876146
342 344 12023 FL Columbia County 6.0 4.0 5.0 3.0 4.0 67531 ... 8.875016 10.033635 -3.870623 7.515460 -7.036528 5.074002 4.574168 14.350794 9.234620 10.518214
343 345 12027 FL DeSoto County 6.0 6.0 5.0 5.0 0.0 34862 ... 20.540585 -0.883049 -5.962106 1.832577 -4.462817 10.021495 7.437248 15.018565 26.716363 5.325056
344 346 12029 FL Dixie County 6.0 6.0 7.0 7.0 4.0 16422 ... 13.898541 8.759299 3.474974 -12.285390 -2.419580 2.179260 23.772769 10.666504 13.717255 8.579314
345 347 12031 FL Duval County 1.0 1.0 1.0 1.0 0.0 864263 ... 3.258143 4.236626 1.403966 3.205904 1.408778 6.491212 9.740351 11.034640 7.523993 8.642759
346 348 12033 FL Escambia County 2.0 2.0 2.0 2.0 0.0 297619 ... 2.067878 4.780595 1.797802 10.279484 8.697306 1.890574 2.954885 5.202386 3.652398 5.842950
347 349 12035 FL Flagler County 4.0 2.0 5.0 2.0 0.0 95696 ... 26.738706 22.359957 16.544213 12.352485 18.430065 24.110480 27.672505 32.185710 28.036523 23.801373
348 350 12037 FL Franklin County 6.0 6.0 7.0 6.0 4.0 11549 ... -5.512679 -2.384196 -2.522726 12.826624 -5.188292 13.633030 6.163328 13.936098 -4.240522 -1.021798
349 351 12039 FL Gadsden County 2.0 2.0 2.0 2.0 4.0 46389 ... -4.933549 -4.049376 -12.211141 -20.117726 -11.524641 -1.279702 -3.363350 -1.737204 -3.999000 -3.047918
350 352 12041 FL Gilchrist County 3.0 2.0 2.0 2.0 4.0 16939 ... 15.114345 21.981673 -1.294536 -6.079924 2.304624 3.123159 22.121318 12.240112 15.227138 22.092412
351 353 12043 FL Glades County 6.0 6.0 4.0 4.0 0.0 12884 ... 14.133491 9.512659 0.000000 -10.507332 4.182780 24.118014 16.805433 26.610380 16.723398 12.366457
352 354 12045 FL Gulf County 6.0 3.0 6.0 2.0 4.0 15863 ... 6.090172 5.946850 -2.279852 2.854877 12.449444 9.347260 -0.062641 12.504298 6.649473 6.628260
353 355 12047 FL Hamilton County 6.0 6.0 7.0 6.0 4.0 14799 ... 3.345181 -7.526395 -10.179334 7.641921 -27.736674 -19.782463 13.480608 1.329787 4.042094 -6.481062
354 356 12049 FL Hardee County 6.0 6.0 5.0 3.0 0.0 27731 ... -8.267348 -4.848752 -9.204779 -16.761601 -11.102387 -9.047619 -9.510520 -4.814937 -7.716191 -4.261024
355 357 12051 FL Hendry County 4.0 4.0 5.0 3.0 1.0 39140 ... 5.612515 -8.295042 -10.001282 -38.535595 -10.988140 10.924953 13.259157 12.313038 17.452952 3.796856
356 358 12053 FL Hernando County 1.0 1.0 1.0 1.0 0.0 172778 ... 27.627511 25.420430 4.904626 5.342224 11.519340 14.614144 20.488520 31.117288 29.641904 27.909514
357 359 12055 FL Highlands County 4.0 3.0 5.0 2.0 0.0 98786 ... 19.539299 13.461649 3.388953 3.192695 4.941164 10.676482 21.294787 24.978633 25.260484 19.972886
358 360 12057 FL Hillsborough County 1.0 1.0 1.0 1.0 0.0 1229226 ... 8.540700 6.234626 23.506339 2.638649 4.392095 12.691301 18.177188 18.469221 16.187132 14.672271
359 361 12059 FL Holmes County 6.0 6.0 6.0 6.0 4.0 19927 ... 5.510209 3.288375 2.923166 -4.654222 -1.221654 2.144991 -13.183644 8.898316 5.149728 3.031471
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
368 370 12077 FL Liberty County 8.0 8.0 7.0 7.0 4.0 8365 ... -11.484526 23.833763 -11.680414 3.381847 5.403458 2.742666 -1.783379 -14.362657 -11.605416 23.953530
369 371 12079 FL Madison County 6.0 6.0 6.0 6.0 0.0 19224 ... 8.051355 3.892523 -6.565407 -9.027450 -9.857961 -6.155823 -5.178552 -7.614282 9.139375 5.027842
370 372 12081 FL Manatee County 2.0 2.0 2.0 2.0 5.0 322833 ... 24.233359 21.817110 12.912918 19.001111 23.488538 25.844813 32.810181 35.894844 28.015961 25.825799
371 373 12083 FL Marion County 2.0 2.0 2.0 2.0 0.0 331298 ... 19.712495 19.179088 5.822653 7.964874 7.844345 12.561388 16.320004 19.692741 21.728222 21.838491
372 374 12085 FL Martin County 2.0 2.0 2.0 2.0 5.0 146318 ... 11.470124 10.077829 9.674979 11.170700 18.198962 17.272599 20.040353 21.932813 13.035089 11.886350
373 375 12086 FL Miami-Dade County 1.0 1.0 1.0 1.0 0.0 2496435 ... -17.223379 -18.767415 19.493311 7.507676 8.228990 4.342877 5.488222 8.055105 3.888466 2.564625
374 376 12087 FL Monroe County 4.0 4.0 3.0 3.0 5.0 73090 ... -10.311292 -26.690755 9.430437 7.136557 15.810960 4.588543 5.399399 4.151538 -4.140140 -20.743359
375 377 12089 FL Nassau County 1.0 1.0 1.0 1.0 5.0 73314 ... 35.414096 35.958173 7.504131 4.170843 11.007632 11.145037 22.077661 25.794769 35.659686 36.313843
376 378 12091 FL Okaloosa County 3.0 3.0 2.0 2.0 0.0 180822 ... 10.362823 12.050040 6.981801 28.848140 10.181510 4.017246 10.747263 7.159023 12.328442 13.461393
377 379 12093 FL Okeechobee County 4.0 4.0 5.0 3.0 0.0 39996 ... 8.155890 6.019946 -7.284196 -7.538730 -8.256638 -1.188790 4.381933 20.434005 10.011721 7.833182
378 380 12095 FL Orange County 1.0 1.0 1.0 1.0 5.0 1145956 ... 2.316101 -0.147792 11.839841 19.304544 13.548478 16.408605 19.434381 19.374632 14.630798 14.395053
379 381 12097 FL Osceola County 1.0 1.0 1.0 1.0 5.0 268685 ... 18.879157 12.169552 24.456769 28.681426 28.282320 31.491987 32.335773 36.222154 37.378819 36.763981
380 382 12099 FL Palm Beach County 1.0 1.0 1.0 1.0 5.0 1320134 ... 4.687647 2.476762 9.449820 12.869561 15.471997 15.401936 18.037882 18.280507 13.077220 11.072703
381 383 12101 FL Pasco County 1.0 1.0 1.0 1.0 0.0 464697 ... 28.755012 26.898956 3.770734 8.450232 11.885228 20.101206 25.106707 31.562983 31.044978 29.359856
382 384 12103 FL Pinellas County 1.0 1.0 1.0 1.0 0.0 916542 ... 9.500311 7.100744 5.336810 6.595555 10.661925 11.371551 14.988971 16.939933 12.926144 10.715911
383 385 12105 FL Polk County 2.0 2.0 2.0 2.0 0.0 602095 ... 22.512215 23.991293 9.203089 6.866167 9.959635 16.434516 20.578550 25.177301 27.563743 30.484152
384 386 12107 FL Putnam County 4.0 4.0 3.0 3.0 0.0 74364 ... 15.724155 11.833437 -6.831433 -9.239104 -5.410466 -3.561283 1.626095 8.010366 16.026015 12.429853
385 387 12109 FL St. Johns County 1.0 1.0 1.0 1.0 5.0 190039 ... 35.174683 39.478993 22.895147 27.663011 33.914121 36.848781 36.671025 35.990118 36.552772 40.904155
386 388 12111 FL St. Lucie County 2.0 2.0 2.0 2.0 0.0 277789 ... 21.287488 21.300872 6.432906 8.320997 8.202779 16.166362 25.054970 27.817975 25.334403 25.505573
387 389 12113 FL Santa Rosa County 2.0 2.0 2.0 2.0 0.0 151372 ... 21.578028 28.130995 14.314875 12.028887 9.950467 10.474899 18.540590 18.499180 21.595472 27.785795
388 390 12115 FL Sarasota County 2.0 2.0 2.0 2.0 5.0 379448 ... 19.867518 20.715802 11.485777 16.131382 15.099258 21.700265 26.864282 26.346518 23.018652 23.875039
389 391 12117 FL Seminole County 1.0 1.0 1.0 1.0 0.0 422718 ... 7.009471 3.840579 3.958256 6.512255 8.327271 10.568038 12.446906 13.512392 11.996936 9.764877
390 392 12119 FL Sumter County 4.0 3.0 3.0 2.0 4.0 93420 ... 35.516426 41.255563 45.409623 44.608958 58.240884 55.942652 50.672656 51.826909 35.500227 41.397470
391 393 12121 FL Suwannee County 6.0 6.0 6.0 6.0 0.0 41551 ... 9.866664 3.894619 24.390244 5.178902 3.145268 6.478344 0.571723 5.873749 10.048538 4.121050
392 394 12123 FL Taylor County 6.0 6.0 6.0 6.0 3.0 22570 ... -13.840200 -9.807081 1.326084 3.083089 5.742969 -13.730279 -6.942745 -11.017426 -12.793080 -8.149546
393 395 12125 FL Union County 6.0 6.0 7.0 4.0 0.0 15535 ... 19.009798 -30.319971 -14.849399 -2.879864 -4.142012 8.480705 7.729089 4.586254 19.921227 -29.267651
394 396 12127 FL Volusia County 2.0 2.0 2.0 2.0 0.0 494593 ... 19.060348 17.424414 3.234007 7.350463 11.259655 15.870778 23.424740 26.059971 22.162716 21.173085
395 397 12129 FL Wakulla County 2.0 2.0 2.0 2.0 4.0 30776 ... 4.406663 8.333075 1.197508 -5.823170 3.362921 10.415164 0.699167 9.366869 5.062975 9.169480
396 398 12131 FL Walton County 6.0 3.0 6.0 2.0 5.0 55043 ... 40.558028 42.005013 5.758071 24.969852 31.089953 29.210179 26.804904 33.598530 41.006844 42.420337
397 399 12133 FL Washington County 6.0 6.0 6.0 6.0 4.0 24896 ... 7.374361 11.798457 -6.662739 10.234126 -9.828808 -5.901277 11.461083 0.285528 8.392919 12.768193

68 rows × 150 columns

In [76]:
florida = florida.loc[florida['Area_Name'] != 'Florida']
florida
Out[76]:
1 FIPS State Area_Name Rural-urban_Continuum Code_2003 Rural-urban_Continuum Code_2013 Urban_Influence_Code_2003 Urban_Influence_Code_2013 Economic_typology_2015 CENSUS_2010_POP ... R_DOMESTIC_MIG_2017 R_DOMESTIC_MIG_2018 R_NET_MIG_2011 R_NET_MIG_2012 R_NET_MIG_2013 R_NET_MIG_2014 R_NET_MIG_2015 R_NET_MIG_2016 R_NET_MIG_2017 R_NET_MIG_2018
331 333 12001 FL Alachua County 3.0 2.0 2.0 2.0 4.0 247336 ... 0.376572 2.362252 4.656034 1.583822 -0.226186 7.795322 10.220022 15.588465 6.518460 8.685187
332 334 12003 FL Baker County 1.0 1.0 1.0 1.0 4.0 27115 ... 9.054936 2.156048 -5.618704 -4.141246 -4.181468 -2.254291 5.838183 14.885102 9.304481 2.403464
333 335 12005 FL Bay County 3.0 3.0 2.0 2.0 5.0 168852 ... -0.364695 3.000003 -0.879715 8.772598 13.292720 18.316233 14.568019 8.207889 1.943227 5.328525
334 336 12007 FL Bradford County 6.0 6.0 6.0 4.0 0.0 28520 ... 16.113163 23.475804 -5.195899 -54.144662 -10.324593 -9.333533 7.092465 -0.336581 16.335926 23.767429
335 337 12009 FL Brevard County 2.0 2.0 2.0 2.0 0.0 543376 ... 20.126921 15.053404 2.892609 6.812078 8.871124 11.863769 21.535499 22.955752 22.805363 18.062397
336 338 12011 FL Broward County 1.0 1.0 1.0 1.0 0.0 1748066 ... -2.948968 -5.320492 15.402613 11.451518 8.808876 9.111415 8.941446 10.529641 7.739676 5.613873
337 339 12013 FL Calhoun County 6.0 6.0 7.0 6.0 4.0 14625 ... 8.828334 12.196803 6.879875 -4.357002 -4.445964 -8.198980 -0.554362 -1.948165 9.036877 12.403528
338 340 12015 FL Charlotte County 3.0 3.0 2.0 2.0 5.0 159978 ... 28.068886 26.300353 7.881946 24.730316 19.710301 28.001406 33.960624 38.702418 30.100846 28.368369
339 341 12017 FL Citrus County 4.0 3.0 5.0 2.0 0.0 141236 ... 27.930171 26.274447 -1.238756 4.890098 7.784033 10.012137 21.436964 28.217163 28.422608 26.778807
340 342 12019 FL Clay County 1.0 1.0 1.0 1.0 0.0 190865 ... 19.893950 14.328113 1.157118 5.076221 6.655010 12.059348 16.530410 21.106698 21.911002 16.401673
341 343 12021 FL Collier County 2.0 2.0 2.0 2.0 5.0 321520 ... 11.923708 10.111436 14.167360 13.417001 19.480384 22.931536 24.462884 25.254625 19.674931 17.876146
342 344 12023 FL Columbia County 6.0 4.0 5.0 3.0 4.0 67531 ... 8.875016 10.033635 -3.870623 7.515460 -7.036528 5.074002 4.574168 14.350794 9.234620 10.518214
343 345 12027 FL DeSoto County 6.0 6.0 5.0 5.0 0.0 34862 ... 20.540585 -0.883049 -5.962106 1.832577 -4.462817 10.021495 7.437248 15.018565 26.716363 5.325056
344 346 12029 FL Dixie County 6.0 6.0 7.0 7.0 4.0 16422 ... 13.898541 8.759299 3.474974 -12.285390 -2.419580 2.179260 23.772769 10.666504 13.717255 8.579314
345 347 12031 FL Duval County 1.0 1.0 1.0 1.0 0.0 864263 ... 3.258143 4.236626 1.403966 3.205904 1.408778 6.491212 9.740351 11.034640 7.523993 8.642759
346 348 12033 FL Escambia County 2.0 2.0 2.0 2.0 0.0 297619 ... 2.067878 4.780595 1.797802 10.279484 8.697306 1.890574 2.954885 5.202386 3.652398 5.842950
347 349 12035 FL Flagler County 4.0 2.0 5.0 2.0 0.0 95696 ... 26.738706 22.359957 16.544213 12.352485 18.430065 24.110480 27.672505 32.185710 28.036523 23.801373
348 350 12037 FL Franklin County 6.0 6.0 7.0 6.0 4.0 11549 ... -5.512679 -2.384196 -2.522726 12.826624 -5.188292 13.633030 6.163328 13.936098 -4.240522 -1.021798
349 351 12039 FL Gadsden County 2.0 2.0 2.0 2.0 4.0 46389 ... -4.933549 -4.049376 -12.211141 -20.117726 -11.524641 -1.279702 -3.363350 -1.737204 -3.999000 -3.047918
350 352 12041 FL Gilchrist County 3.0 2.0 2.0 2.0 4.0 16939 ... 15.114345 21.981673 -1.294536 -6.079924 2.304624 3.123159 22.121318 12.240112 15.227138 22.092412
351 353 12043 FL Glades County 6.0 6.0 4.0 4.0 0.0 12884 ... 14.133491 9.512659 0.000000 -10.507332 4.182780 24.118014 16.805433 26.610380 16.723398 12.366457
352 354 12045 FL Gulf County 6.0 3.0 6.0 2.0 4.0 15863 ... 6.090172 5.946850 -2.279852 2.854877 12.449444 9.347260 -0.062641 12.504298 6.649473 6.628260
353 355 12047 FL Hamilton County 6.0 6.0 7.0 6.0 4.0 14799 ... 3.345181 -7.526395 -10.179334 7.641921 -27.736674 -19.782463 13.480608 1.329787 4.042094 -6.481062
354 356 12049 FL Hardee County 6.0 6.0 5.0 3.0 0.0 27731 ... -8.267348 -4.848752 -9.204779 -16.761601 -11.102387 -9.047619 -9.510520 -4.814937 -7.716191 -4.261024
355 357 12051 FL Hendry County 4.0 4.0 5.0 3.0 1.0 39140 ... 5.612515 -8.295042 -10.001282 -38.535595 -10.988140 10.924953 13.259157 12.313038 17.452952 3.796856
356 358 12053 FL Hernando County 1.0 1.0 1.0 1.0 0.0 172778 ... 27.627511 25.420430 4.904626 5.342224 11.519340 14.614144 20.488520 31.117288 29.641904 27.909514
357 359 12055 FL Highlands County 4.0 3.0 5.0 2.0 0.0 98786 ... 19.539299 13.461649 3.388953 3.192695 4.941164 10.676482 21.294787 24.978633 25.260484 19.972886
358 360 12057 FL Hillsborough County 1.0 1.0 1.0 1.0 0.0 1229226 ... 8.540700 6.234626 23.506339 2.638649 4.392095 12.691301 18.177188 18.469221 16.187132 14.672271
359 361 12059 FL Holmes County 6.0 6.0 6.0 6.0 4.0 19927 ... 5.510209 3.288375 2.923166 -4.654222 -1.221654 2.144991 -13.183644 8.898316 5.149728 3.031471
360 362 12061 FL Indian River County 3.0 3.0 2.0 2.0 5.0 138028 ... 22.555161 22.667270 9.042009 13.148059 14.568092 21.858916 26.011571 30.060992 25.016200 25.156627
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
368 370 12077 FL Liberty County 8.0 8.0 7.0 7.0 4.0 8365 ... -11.484526 23.833763 -11.680414 3.381847 5.403458 2.742666 -1.783379 -14.362657 -11.605416 23.953530
369 371 12079 FL Madison County 6.0 6.0 6.0 6.0 0.0 19224 ... 8.051355 3.892523 -6.565407 -9.027450 -9.857961 -6.155823 -5.178552 -7.614282 9.139375 5.027842
370 372 12081 FL Manatee County 2.0 2.0 2.0 2.0 5.0 322833 ... 24.233359 21.817110 12.912918 19.001111 23.488538 25.844813 32.810181 35.894844 28.015961 25.825799
371 373 12083 FL Marion County 2.0 2.0 2.0 2.0 0.0 331298 ... 19.712495 19.179088 5.822653 7.964874 7.844345 12.561388 16.320004 19.692741 21.728222 21.838491
372 374 12085 FL Martin County 2.0 2.0 2.0 2.0 5.0 146318 ... 11.470124 10.077829 9.674979 11.170700 18.198962 17.272599 20.040353 21.932813 13.035089 11.886350
373 375 12086 FL Miami-Dade County 1.0 1.0 1.0 1.0 0.0 2496435 ... -17.223379 -18.767415 19.493311 7.507676 8.228990 4.342877 5.488222 8.055105 3.888466 2.564625
374 376 12087 FL Monroe County 4.0 4.0 3.0 3.0 5.0 73090 ... -10.311292 -26.690755 9.430437 7.136557 15.810960 4.588543 5.399399 4.151538 -4.140140 -20.743359
375 377 12089 FL Nassau County 1.0 1.0 1.0 1.0 5.0 73314 ... 35.414096 35.958173 7.504131 4.170843 11.007632 11.145037 22.077661 25.794769 35.659686 36.313843
376 378 12091 FL Okaloosa County 3.0 3.0 2.0 2.0 0.0 180822 ... 10.362823 12.050040 6.981801 28.848140 10.181510 4.017246 10.747263 7.159023 12.328442 13.461393
377 379 12093 FL Okeechobee County 4.0 4.0 5.0 3.0 0.0 39996 ... 8.155890 6.019946 -7.284196 -7.538730 -8.256638 -1.188790 4.381933 20.434005 10.011721 7.833182
378 380 12095 FL Orange County 1.0 1.0 1.0 1.0 5.0 1145956 ... 2.316101 -0.147792 11.839841 19.304544 13.548478 16.408605 19.434381 19.374632 14.630798 14.395053
379 381 12097 FL Osceola County 1.0 1.0 1.0 1.0 5.0 268685 ... 18.879157 12.169552 24.456769 28.681426 28.282320 31.491987 32.335773 36.222154 37.378819 36.763981
380 382 12099 FL Palm Beach County 1.0 1.0 1.0 1.0 5.0 1320134 ... 4.687647 2.476762 9.449820 12.869561 15.471997 15.401936 18.037882 18.280507 13.077220 11.072703
381 383 12101 FL Pasco County 1.0 1.0 1.0 1.0 0.0 464697 ... 28.755012 26.898956 3.770734 8.450232 11.885228 20.101206 25.106707 31.562983 31.044978 29.359856
382 384 12103 FL Pinellas County 1.0 1.0 1.0 1.0 0.0 916542 ... 9.500311 7.100744 5.336810 6.595555 10.661925 11.371551 14.988971 16.939933 12.926144 10.715911
383 385 12105 FL Polk County 2.0 2.0 2.0 2.0 0.0 602095 ... 22.512215 23.991293 9.203089 6.866167 9.959635 16.434516 20.578550 25.177301 27.563743 30.484152
384 386 12107 FL Putnam County 4.0 4.0 3.0 3.0 0.0 74364 ... 15.724155 11.833437 -6.831433 -9.239104 -5.410466 -3.561283 1.626095 8.010366 16.026015 12.429853
385 387 12109 FL St. Johns County 1.0 1.0 1.0 1.0 5.0 190039 ... 35.174683 39.478993 22.895147 27.663011 33.914121 36.848781 36.671025 35.990118 36.552772 40.904155
386 388 12111 FL St. Lucie County 2.0 2.0 2.0 2.0 0.0 277789 ... 21.287488 21.300872 6.432906 8.320997 8.202779 16.166362 25.054970 27.817975 25.334403 25.505573
387 389 12113 FL Santa Rosa County 2.0 2.0 2.0 2.0 0.0 151372 ... 21.578028 28.130995 14.314875 12.028887 9.950467 10.474899 18.540590 18.499180 21.595472 27.785795
388 390 12115 FL Sarasota County 2.0 2.0 2.0 2.0 5.0 379448 ... 19.867518 20.715802 11.485777 16.131382 15.099258 21.700265 26.864282 26.346518 23.018652 23.875039
389 391 12117 FL Seminole County 1.0 1.0 1.0 1.0 0.0 422718 ... 7.009471 3.840579 3.958256 6.512255 8.327271 10.568038 12.446906 13.512392 11.996936 9.764877
390 392 12119 FL Sumter County 4.0 3.0 3.0 2.0 4.0 93420 ... 35.516426 41.255563 45.409623 44.608958 58.240884 55.942652 50.672656 51.826909 35.500227 41.397470
391 393 12121 FL Suwannee County 6.0 6.0 6.0 6.0 0.0 41551 ... 9.866664 3.894619 24.390244 5.178902 3.145268 6.478344 0.571723 5.873749 10.048538 4.121050
392 394 12123 FL Taylor County 6.0 6.0 6.0 6.0 3.0 22570 ... -13.840200 -9.807081 1.326084 3.083089 5.742969 -13.730279 -6.942745 -11.017426 -12.793080 -8.149546
393 395 12125 FL Union County 6.0 6.0 7.0 4.0 0.0 15535 ... 19.009798 -30.319971 -14.849399 -2.879864 -4.142012 8.480705 7.729089 4.586254 19.921227 -29.267651
394 396 12127 FL Volusia County 2.0 2.0 2.0 2.0 0.0 494593 ... 19.060348 17.424414 3.234007 7.350463 11.259655 15.870778 23.424740 26.059971 22.162716 21.173085
395 397 12129 FL Wakulla County 2.0 2.0 2.0 2.0 4.0 30776 ... 4.406663 8.333075 1.197508 -5.823170 3.362921 10.415164 0.699167 9.366869 5.062975 9.169480
396 398 12131 FL Walton County 6.0 3.0 6.0 2.0 5.0 55043 ... 40.558028 42.005013 5.758071 24.969852 31.089953 29.210179 26.804904 33.598530 41.006844 42.420337
397 399 12133 FL Washington County 6.0 6.0 6.0 6.0 4.0 24896 ... 7.374361 11.798457 -6.662739 10.234126 -9.828808 -5.901277 11.461083 0.285528 8.392919 12.768193

67 rows × 150 columns

In [77]:
florida_graph_2018 = px.line(florida, x = 'Area_Name', y = 'INTERNATIONAL_MIG_2018', title = 'Internation Migration Settlement in Florida')
florida_graph_2018.show()
In [78]:
florida_graph_2017 = px.line(florida, x = 'Area_Name', y = 'INTERNATIONAL_MIG_2017', title = 'Internation Migration Settlement in Florida')
florida_graph_2017.show()
In [79]:
florida_graph_2016 = px.line(florida, x = 'Area_Name', y = 'INTERNATIONAL_MIG_2016', title = 'Internation Migration Settlement in Florida')
florida_graph_2016.show()
In [80]:
florida['text'] = "International Migration 2018"+"\
    "+ florida["INTERNATIONAL_MIG_2018"].astype(str) + " " +"County:" +" \
    "+ florida["Area_Name"]

values = florida['INTERNATIONAL_MIG_2018'].tolist()
fips = florida['FIPS'].tolist()

endpts = list(np.mgrid[min(values):max(values):4j])

colorscale = [
    '#ffcccc',
    '#ff9999',
    '#ff6666',
    '#ff3333',
    '#ff0000'
]
fig = ff.create_choropleth(
    fips=fips, values=values, scope=['Florida'], show_state_data=True,
    colorscale=colorscale, binning_endpoints=endpts, round_legend_values=True,
    plot_bgcolor='rgb(229,229,229)',
    paper_bgcolor='rgb(229,229,229)',
    legend_title='International Population by County 2018',
    county_outline={'color': 'rgb(255,255,255)', 'width': 0.5},
    exponent_format=False,

   
)


fig.layout.template = None
fig.show()
/home/emma/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py:6692: FutureWarning:

Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.

To accept the future behavior, pass 'sort=False'.

To retain the current behavior and silence the warning, pass 'sort=True'.


In [81]:
x = florida['FIPS'].tolist()
fips = [str(i) for i in x]
values = florida['INTERNATIONAL_MIG_2018'].tolist()

fig = ff.create_choropleth(fips=fips, values=values)
fig.layout.template = None
fig.show()
In [82]:
florida_counties = ['Broward County','Orange County', 'Miami-Dade County']
florida_pop = florida.loc[florida['Area_Name'].isin(florida_counties)]
florida_pop
Out[82]:
1 FIPS State Area_Name Rural-urban_Continuum Code_2003 Rural-urban_Continuum Code_2013 Urban_Influence_Code_2003 Urban_Influence_Code_2013 Economic_typology_2015 CENSUS_2010_POP ... R_DOMESTIC_MIG_2018 R_NET_MIG_2011 R_NET_MIG_2012 R_NET_MIG_2013 R_NET_MIG_2014 R_NET_MIG_2015 R_NET_MIG_2016 R_NET_MIG_2017 R_NET_MIG_2018 text
336 338 12011 FL Broward County 1.0 1.0 1.0 1.0 0.0 1748066 ... -5.320492 15.402613 11.451518 8.808876 9.111415 8.941446 10.529641 7.739676 5.613873 International Migration 2018 21244.0 County...
373 375 12086 FL Miami-Dade County 1.0 1.0 1.0 1.0 0.0 2496435 ... -18.767415 19.493311 7.507676 8.228990 4.342877 5.488222 8.055105 3.888466 2.564625 International Migration 2018 58732.0 County...
378 380 12095 FL Orange County 1.0 1.0 1.0 1.0 5.0 1145956 ... -0.147792 11.839841 19.304544 13.548478 16.408605 19.434381 19.374632 14.630798 14.395053 International Migration 2018 19877.0 County...

3 rows × 151 columns

Now let's see international migration to Califonia

In [83]:
ca = population_data.loc[population_data['State'] == 'CA']
In [84]:
california = ca.loc[ca['Area_Name'] != 'California']
In [85]:
california
Out[85]:
1 FIPS State Area_Name Rural-urban_Continuum Code_2003 Rural-urban_Continuum Code_2013 Urban_Influence_Code_2003 Urban_Influence_Code_2013 Economic_typology_2015 CENSUS_2010_POP ... R_DOMESTIC_MIG_2017 R_DOMESTIC_MIG_2018 R_NET_MIG_2011 R_NET_MIG_2012 R_NET_MIG_2013 R_NET_MIG_2014 R_NET_MIG_2015 R_NET_MIG_2016 R_NET_MIG_2017 R_NET_MIG_2018
192 194 6001 CA Alameda County 1.0 1.0 1.0 1.0 0.0 1510271 ... -7.072826 -6.036301 5.248944 8.680330 10.338870 11.363718 9.989801 3.593977 -0.525928 0.410240
193 195 6003 CA Alpine County 8.0 8.0 4.0 4.0 5.0 1175 ... 60.606061 -20.702070 -58.562555 15.433500 16.092982 -41.647804 1.844168 -23.320896 60.606061 -20.702070
194 196 6005 CA Amador County 6.0 6.0 4.0 4.0 4.0 38091 ... 31.767756 24.225627 -4.534486 -7.904715 -8.518026 6.706378 11.602846 14.179255 32.136230 24.584905
195 197 6007 CA Butte County 3.0 3.0 2.0 2.0 0.0 220000 ... 10.269103 7.323064 -1.041153 3.556967 3.547726 7.088407 4.888689 7.298251 11.493496 8.534888
196 198 6009 CA Calaveras County 6.0 6.0 6.0 6.0 5.0 45578 ... 9.984056 1.994652 -4.192965 -5.401140 0.782289 2.798518 8.903269 10.990472 10.555830 2.564552
197 199 6011 CA Colusa County 6.0 6.0 4.0 4.0 1.0 21419 ... -1.850652 -11.084938 -12.814517 -8.962718 -10.385582 -11.209759 -2.919914 6.071645 -2.081984 -11.269687
198 200 6013 CA Contra Costa County 1.0 1.0 1.0 1.0 0.0 1049025 ... -0.181415 -1.733274 7.461718 6.939211 10.167217 9.701713 9.295584 7.064285 3.212014 1.613889
199 201 6015 CA Del Norte County 7.0 7.0 8.0 8.0 4.0 28610 ... -0.911577 13.392211 -5.753377 -10.630220 -15.676892 -25.229483 0.073470 5.926685 -1.020966 13.319820
200 202 6017 CA El Dorado County 1.0 1.0 1.0 1.0 5.0 181058 ... 13.591104 10.326832 -2.938812 -2.865869 4.308500 7.941688 7.590649 7.282693 14.194085 10.906695
201 203 6019 CA Fresno County 2.0 2.0 2.0 2.0 0.0 930450 ... -0.457114 -1.015678 -3.090500 -4.035381 -2.621512 -0.158884 0.050731 -1.264629 0.841945 0.312982
202 204 6021 CA Glenn County 6.0 6.0 6.0 6.0 1.0 28122 ... -0.788432 -1.071371 -6.220011 -15.141776 -7.542291 -3.771349 -7.477576 -1.402197 -1.648539 -1.928468
203 205 6023 CA Humboldt County 5.0 5.0 8.0 8.0 0.0 134623 ... 0.982257 -1.700257 -0.954795 -5.960523 -2.885112 -0.029749 3.426944 7.758964 0.996918 -1.670942
204 206 6025 CA Imperial County 3.0 3.0 2.0 2.0 4.0 174528 ... -4.327856 -9.966951 -6.087698 -6.882445 -12.324397 -3.122552 -7.593478 -4.901974 -3.100801 -8.668110
205 207 6027 CA Inyo County 7.0 7.0 8.0 11.0 5.0 18546 ... -1.279769 2.671490 -6.123831 -3.374517 -0.490290 -5.288986 -10.796295 -10.948300 -0.834632 3.228051
206 208 6029 CA Kern County 2.0 2.0 2.0 2.0 0.0 839631 ... -1.878794 -0.350553 -2.254306 -3.765930 -0.137487 -1.137076 -1.089772 -3.201940 -0.828747 0.704465
207 209 6031 CA Kings County 3.0 3.0 2.0 2.0 4.0 152982 ... -7.987834 2.650617 -15.571850 -16.513047 -15.425853 -15.659008 -6.330845 -14.460742 -7.987834 2.271957
208 210 6033 CA Lake County 4.0 4.0 5.0 5.0 0.0 64665 ... 6.075941 5.087752 -6.605573 -2.402309 -0.829603 4.942636 5.455452 -3.558663 5.763554 4.776575
209 211 6035 CA Lassen County 6.0 7.0 6.0 8.0 4.0 34895 ... 3.288784 -13.015745 -20.529897 -19.804898 -48.912548 -17.262986 -15.564326 -18.366004 3.804672 -12.498991
210 212 6037 CA Los Angeles County 1.0 1.0 1.0 1.0 0.0 9818605 ... -9.014344 -9.751449 -2.039782 -0.847533 -1.024852 -2.051329 -1.904053 -3.681945 -5.558295 -6.300744
211 213 6039 CA Madera County 3.0 3.0 2.0 2.0 0.0 150865 ... 3.231591 3.163507 -4.803309 -9.680312 -9.146583 5.834918 -7.125914 -5.073092 3.031632 3.023191
212 214 6041 CA Marin County 1.0 1.0 1.0 1.0 5.0 252409 ... -6.495528 -2.760926 7.559004 1.079316 7.626452 5.608147 0.874483 -2.917671 -4.408503 -0.662314
213 215 6043 CA Mariposa County 8.0 8.0 7.0 7.0 5.0 18251 ... 0.974435 1.833391 -5.597476 -15.534842 -0.056041 -3.659807 -2.547050 -7.298230 1.662272 2.635499
214 216 6045 CA Mendocino County 4.0 4.0 5.0 5.0 5.0 87841 ... 1.782053 -2.452896 -7.422888 -3.813603 -4.931730 -0.034417 -2.740433 0.962475 1.702089 -2.464305
215 217 6047 CA Merced County 3.0 2.0 2.0 2.0 0.0 255793 ... 3.767770 3.852739 -0.829353 -4.197546 -5.199085 -0.379617 -1.554677 -3.797075 4.042195 4.164034
216 218 6049 CA Modoc County 6.0 6.0 6.0 6.0 4.0 9686 ... -7.872687 -7.375887 -19.676227 -11.448561 -19.130999 -4.278896 1.875552 -7.896347 -6.748018 -6.241135
217 219 6051 CA Mono County 7.0 7.0 9.0 11.0 5.0 14202 ... -5.485811 -7.653151 3.417015 -13.214174 -24.711349 -2.551744 -15.185382 4.956629 -2.672574 -4.774443
218 220 6053 CA Monterey County 2.0 2.0 2.0 2.0 5.0 415057 ... -7.370347 -8.137109 -0.838772 0.253092 -4.844763 -5.135310 -4.110572 -0.508078 -6.497028 -7.361053
219 221 6055 CA Napa County 3.0 3.0 2.0 2.0 5.0 136484 ... -7.550493 -8.084259 4.479928 3.603799 6.632391 4.038919 2.101803 -0.843131 -6.534764 -7.069259
220 222 6057 CA Nevada County 4.0 4.0 3.0 3.0 5.0 98764 ... 7.245537 3.714878 0.982368 -3.718813 0.295780 7.550587 3.335057 4.208971 7.477314 3.965883
221 223 6059 CA Orange County 1.0 1.0 1.0 1.0 0.0 3010232 ... -5.697048 -6.316135 4.648429 3.295557 2.963596 1.025595 1.366584 -0.461368 -2.430615 -3.084551
222 224 6061 CA Placer County 1.0 1.0 1.0 1.0 5.0 348432 ... 14.397538 17.711252 14.644547 8.509759 11.844756 8.408062 8.529279 15.099436 15.265679 18.504868
223 225 6063 CA Plumas County 7.0 7.0 12.0 12.0 5.0 20007 ... 0.639795 7.244833 -7.216937 -15.247256 -18.970969 -10.543973 -5.594707 16.037331 0.746428 7.351374
224 226 6065 CA Riverside County 1.0 1.0 1.0 1.0 5.0 2189641 ... 8.124932 7.797892 7.241285 5.477876 5.000868 6.410337 6.588259 8.565707 8.932883 8.603565
225 227 6067 CA Sacramento County 1.0 1.0 1.0 1.0 4.0 1418788 ... 2.730957 1.077332 1.775036 1.751414 2.689102 6.172427 6.898521 6.073583 5.644196 3.919584
226 228 6069 CA San Benito County 1.0 1.0 1.0 1.0 0.0 55269 ... 9.427801 15.016100 -0.394622 3.570287 4.179802 3.335244 -0.654552 9.993360 8.808212 14.490373
227 229 6071 CA San Bernardino County 1.0 1.0 1.0 1.0 0.0 2035210 ... 0.785095 0.713558 0.539743 -2.327800 -3.937407 -0.291064 -0.639152 -0.034811 1.506749 1.384571
228 230 6073 CA San Diego County 1.0 1.0 1.0 1.0 0.0 3095313 ... -4.747920 -3.249445 3.017621 4.541413 4.196698 4.880969 2.970136 1.247433 -1.311985 -0.157149
229 231 6075 CA San Francisco County 1.0 1.0 1.0 1.0 0.0 805235 ... -3.046871 -5.131432 8.549080 12.062961 8.889858 9.135655 10.757152 6.513761 4.311740 2.116347
230 232 6077 CA San Joaquin County 2.0 2.0 2.0 2.0 0.0 685306 ... 6.281951 5.947126 2.227942 0.522174 -3.557346 6.972347 8.286252 7.662398 7.749367 7.398460
231 233 6079 CA San Luis Obispo County 3.0 2.0 2.0 2.0 5.0 269637 ... 1.883866 3.066078 3.294783 10.047062 4.462346 7.847710 5.930521 5.532538 2.453983 3.658829
232 234 6081 CA San Mateo County 1.0 1.0 1.0 1.0 0.0 718451 ... -9.936162 -9.515371 5.741201 9.056901 7.048991 5.738433 4.593212 -2.030449 -3.877654 -3.511548
233 235 6083 CA Santa Barbara County 2.0 2.0 2.0 2.0 0.0 423895 ... -5.133211 -4.831118 -3.881297 3.778765 5.338589 4.173049 0.882206 -0.687559 -2.933905 -2.667764
234 236 6085 CA Santa Clara County 1.0 1.0 1.0 1.0 3.0 1781642 ... -13.502067 -12.733298 6.346427 6.784757 7.800475 6.377175 5.710589 -0.532874 -4.163642 -3.488547
235 237 6087 CA Santa Cruz County 2.0 2.0 2.0 2.0 5.0 262382 ... -2.539073 -6.789719 0.776443 0.353850 4.766921 3.563128 5.275669 -0.452198 -1.578736 -5.821319
236 238 6089 CA Shasta County 3.0 3.0 2.0 2.0 0.0 177223 ... 5.512119 2.686475 1.499229 1.558632 2.952825 2.843501 -2.356787 1.944293 6.522953 3.676522
237 239 6091 CA Sierra County 8.0 8.0 7.0 7.0 5.0 3240 ... 16.426416 -2.668446 -33.544304 -6.811547 -6.561680 -10.650691 9.036145 -10.078952 16.426416 -2.668446
238 240 6093 CA Siskiyou County 7.0 6.0 11.0 6.0 0.0 44900 ... 9.557315 0.777072 -5.583598 -11.456536 -9.634153 -3.083614 1.522228 6.519611 9.832346 1.097043
239 241 6095 CA Solano County 2.0 2.0 2.0 2.0 0.0 413344 ... 5.185823 1.367791 0.248118 3.179411 4.574082 7.531914 5.864199 8.350439 6.718925 2.735582
240 242 6097 CA Sonoma County 2.0 2.0 2.0 2.0 5.0 483878 ... -2.124203 -8.397230 2.620863 3.093625 6.158604 7.208125 3.173527 2.066504 -1.098863 -7.366516
241 243 6099 CA Stanislaus County 2.0 2.0 2.0 2.0 0.0 514453 ... 3.047541 0.675748 -3.241739 -1.685597 -0.938413 2.235597 3.318642 4.812334 4.002548 1.658323
242 244 6101 CA Sutter County 3.0 3.0 2.0 2.0 0.0 94737 ... -2.038100 -3.870734 -9.395576 -9.486208 -1.599958 -2.946535 0.599312 -0.020911 0.322353 -1.635230
243 245 6103 CA Tehama County 4.0 4.0 5.0 5.0 0.0 63463 ... 4.485717 1.504301 -5.437309 -3.508134 -5.740337 -3.787216 2.732805 1.819016 4.123711 1.159566
244 246 6105 CA Trinity County 8.0 8.0 6.0 6.0 4.0 13786 ... -5.321647 -10.371719 -1.530891 -11.852615 -1.486271 -18.832392 1.678300 -14.581083 -5.321647 -10.371719
245 247 6107 CA Tulare County 2.0 2.0 2.0 2.0 0.0 442179 ... -2.339891 -2.704105 -3.191520 -4.645204 -4.714515 -4.293400 -5.266010 -4.497585 -2.166566 -2.482351
246 248 6109 CA Tuolumne County 4.0 4.0 5.0 5.0 5.0 55365 ... 8.260397 10.444105 -3.635835 -8.253625 -1.330647 1.558037 -0.745032 7.570813 9.169969 11.346682
247 249 6111 CA Ventura County 2.0 2.0 2.0 2.0 0.0 823318 ... -3.219348 -4.712743 -0.994366 -2.266831 -0.371920 -0.686273 -0.832018 -2.680673 -1.953259 -3.515166
248 250 6113 CA Yolo County 1.0 1.0 1.0 1.0 4.0 200849 ... 3.461579 -0.273483 -1.667320 7.526157 2.613196 4.136076 11.413055 10.935888 8.356649 4.517029
249 251 6115 CA Yuba County 3.0 3.0 2.0 2.0 4.0 72155 ... 14.323646 6.833919 -7.704947 -5.272432 -4.331556 -2.018053 -0.921128 4.708723 15.022039 7.079372

58 rows × 150 columns

In [86]:
ca_international_mig_2016 = px.line(california, x = 'Area_Name', y='INTERNATIONAL_MIG_2016', title="International Migration to Califonia 2016")
ca_international_mig_2016.show()
In [87]:
ca_international_mig_2017 = px.line(california, x = 'Area_Name', y='INTERNATIONAL_MIG_2017', title="International Migration to Califonia 2017")
ca_international_mig_2017.show()
In [88]:
ca_international_mig_2018 = px.line(california, x = 'Area_Name', y='INTERNATIONAL_MIG_2018', title="International Migration to Califonia 2018")
ca_international_mig_2018.show()
In [89]:
california['text'] = "International Migration 2018"+"\
    "+ california["INTERNATIONAL_MIG_2018"].astype(str) + " " +"County:" +" \
    "+ california["Area_Name"]

values = california['INTERNATIONAL_MIG_2018'].tolist()
fips = california['FIPS'].tolist()

endpts = list(np.mgrid[min(values):max(values):4j])

colorscale = [
    '#ffcccc',
    '#ff9999',
    '#ff6666',
    '#ff3333',
    '#ff0000'
]
fig = ff.create_choropleth(
    fips=fips, values=values, scope=['California'], show_state_data=True,
    colorscale=colorscale, binning_endpoints=endpts, round_legend_values=True,
    plot_bgcolor='rgb(229,229,229)',
    paper_bgcolor='rgb(229,229,229)',
    legend_title='International Population by County 2018',
    county_outline={'color': 'rgb(255,255,255)', 'width': 0.5},
    exponent_format=False,

   
)


fig.layout.template = None
fig.show()
In [90]:
fips = california['FIPS'].tolist()
values = california['INTERNATIONAL_MIG_2018'].tolist()

fig = ff.create_choropleth(fips=fips, values=values)
fig.layout.template = None
fig.show()