人口與住宅十年普查主題表

使用 Python 分析美國 Census 資料

Lee Hachadoorian

Asst. Professor of Instruction, Temple University

普查資料產品

  • Decennial Census of Population and Housing
  • American Community Survey(每年)
  • Current Population Survey(每月)
  • Economic Survey(每 5 年)
  • Annual Survey of State and Local Government Finances(每年)
使用 Python 分析美國 Census 資料

課程先備知識

  • 清單
  • 字典
  • 套件匯入
  • 控制流程、迴圈
  • 串列生成式
  • pandas DataFrame
使用 Python 分析美國 Census 資料

普查主題導覽

Decennial Census of Population and Housing

  • 人口統計(年齡、性別、種族、家庭結構)
  • 住宅居住與所有權(空置/有人、租/自有)
  • 集體居住人口(監獄、學生宿舍)

American Community Survey

  • 教育程度
  • 通勤(方式、出門時間、通勤時長)
  • 障礙狀態
使用 Python 分析美國 Census 資料

主題表結構

主題表 P5 中變數清單-「依種族區分的西語裔或拉丁裔來源」

使用 Python 分析美國 Census 資料

主題表轉為 DataFrame

states.head()
               total          ...           hispanic_multiracial
Alabama      4779736          ...                          10806
Alaska        710231          ...                           6507
Arizona      6392017          ...                         103669
Arkansas     2915918          ...                          11173
California  37253956          ...                         846688

[5 rows x 17 columns]
使用 Python 分析美國 Census 資料

基本資料視覺化

import seaborn as sns

sns.set()
sns.barplot( x = "total", y = states.index, data = states )

延伸學習:Data Visualization with Seaborn

長度與各州總人口成正比的長條圖。

使用 Python 分析美國 Census 資料

一起來練習吧!

使用 Python 分析美國 Census 資料

Preparing Video For Download...