Migration

Analyzing US Census Data in Python

Lee Hachadoorian

Asst. Professor of Instruction, Temple University

ACS Mobility Tables - Common Columns

Table names "B07xxx", generally with columns like these:

  • Total living in area (current residence)
    • Same house 1 year ago (i.e. did not move)
    • Moved within county
    • Moved from a different county, same state
    • Moved from a different state
    • Moved from abroad
Analyzing US Census Data in Python

ACS Mobility Tables - Additional Features

  • Mobility crossed with:
    • Age
    • Educational Attainment
    • Income
    • Citizenship Status
    • etc.
  • Tables based on residence 1 year ago
  • Puerto Rico (e.g. B07001PR: Geographical Mobility in the Past Year by Age for Current Residence in Puerto Rico)
Analyzing US Census Data in Python

Going to California

print(to_cali_2016)
       move_status   persons
0       same_house  32740745
1    within_county   3581323
2     within_state   1062756
3  different_state    501384
4           abroad    305148
sns.barplot(x = "move_status", 
            y = "persons", 
            data = to_cali_2016)

Data from ACS 2016 Table B07001: Geographical Mobility in the Past Year by Age for Current Residence in United States

A barplot showing persons not moving, or moving within the county, state, country, or from abroad.

Analyzing US Census Data in Python

Migration Flows

A spreadsheet showing estimates and margins of error of persons moving within and between states in the United States.

Analyzing US Census Data in Python

State-to-State Migration Matrix

print(state_to_state.head())
            Alabama  Alaska  Arizona  ...  Wisconsin  Wyoming  Puerto Rico
Alabama         NaN   576.0   1022.0  ...      874.0    539.0        335.0
Alaska        423.0     NaN   1176.0  ...      260.0    291.0        848.0
Arizona       894.0  1946.0      NaN  ...     6736.0    925.0       1462.0
Arkansas     2057.0   103.0    836.0  ...      539.0    178.0        857.0
California   3045.0  4206.0  33757.0  ...     7354.0   2674.0       1102.0
Analyzing US Census Data in Python

State-to-State Migration Heatmap

sns.heatmap(state_to_state, cmap="YlGnBu")

A heatmap showing origin and destination states in the rows and columns, respectively, colored by the number of movers in each state-to-state flow.

Analyzing US Census Data in Python

Let's practice!

Analyzing US Census Data in Python

Preparing Video For Download...