diff --git a/Basic Census Reporter API with Pandas.ipynb b/Basic Census Reporter API with Pandas.ipynb
index 0bb823e..f576ad0 100644
--- a/Basic Census Reporter API with Pandas.ipynb
+++ b/Basic Census Reporter API with Pandas.ipynb
@@ -26,7 +26,7 @@
},
"outputs": [],
"source": [
- "df = get_dataframe(column_names=True,level=1)"
+ "df = get_dataframe(tables='B01001',geoids='040|01000US',column_names=True,level=1)"
]
},
{
@@ -119,7 +119,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Top 5 States by Female Population"
+ "## Top 5 States in Midwest Region by % Female Population"
]
},
{
@@ -141,55 +141,61 @@
"
Total | \n",
" Male | \n",
" Female | \n",
+ " pct_female | \n",
" \n",
" \n",
" \n",
" \n",
- " 04000US06 | \n",
- " California | \n",
- " 38332521 | \n",
- " 19072246 | \n",
- " 19260275 | \n",
+ " 04000US47 | \n",
+ " Tennessee | \n",
+ " 6495978 | \n",
+ " 3174148 | \n",
+ " 3321830 | \n",
+ " 0.511367 | \n",
"
\n",
" \n",
- " 04000US48 | \n",
- " Texas | \n",
- " 26448193 | \n",
- " 13145494 | \n",
- " 13302699 | \n",
+ " 04000US42 | \n",
+ " Pennsylvania | \n",
+ " 12773801 | \n",
+ " 6243308 | \n",
+ " 6530493 | \n",
+ " 0.511241 | \n",
"
\n",
" \n",
- " 04000US36 | \n",
- " New York | \n",
- " 19651127 | \n",
- " 9536179 | \n",
- " 10114948 | \n",
+ " 04000US39 | \n",
+ " Ohio | \n",
+ " 11570808 | \n",
+ " 5658223 | \n",
+ " 5912585 | \n",
+ " 0.510992 | \n",
"
\n",
" \n",
- " 04000US12 | \n",
- " Florida | \n",
- " 19552860 | \n",
- " 9565609 | \n",
- " 9987251 | \n",
+ " 04000US29 | \n",
+ " Missouri | \n",
+ " 6044171 | \n",
+ " 2960402 | \n",
+ " 3083769 | \n",
+ " 0.510205 | \n",
"
\n",
" \n",
- " 04000US17 | \n",
- " Illinois | \n",
- " 12882135 | \n",
- " 6326778 | \n",
- " 6555357 | \n",
+ " 04000US26 | \n",
+ " Michigan | \n",
+ " 9895622 | \n",
+ " 4858138 | \n",
+ " 5037484 | \n",
+ " 0.509062 | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " name Total Male Female\n",
- "04000US06 California 38332521 19072246 19260275\n",
- "04000US48 Texas 26448193 13145494 13302699\n",
- "04000US36 New York 19651127 9536179 10114948\n",
- "04000US12 Florida 19552860 9565609 9987251\n",
- "04000US17 Illinois 12882135 6326778 6555357"
+ " name Total Male Female pct_female\n",
+ "04000US47 Tennessee 6495978 3174148 3321830 0.511367\n",
+ "04000US42 Pennsylvania 12773801 6243308 6530493 0.511241\n",
+ "04000US39 Ohio 11570808 5658223 5912585 0.510992\n",
+ "04000US29 Missouri 6044171 2960402 3083769 0.510205\n",
+ "04000US26 Michigan 9895622 4858138 5037484 0.509062"
]
},
"execution_count": 4,
@@ -198,19 +204,21 @@
}
],
"source": [
- "df.sort('Female',ascending=False).head(5)"
+ "df = get_dataframe(tables='B01001',geoids='040|02000US2',column_names=True,level=1)\n",
+ "df['pct_female'] = df['Female'] / df['Total']\n",
+ "df.sort('pct_female',ascending=False).head(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Top 5 States by Male Population"
+ "## Top 5 Tennesse Counties by % Male Population"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 6,
"metadata": {
"collapsed": false
},
@@ -227,64 +235,72 @@
" Total | \n",
" Male | \n",
" Female | \n",
+ " pct_male | \n",
" \n",
" \n",
" \n",
" \n",
- " 04000US06 | \n",
- " California | \n",
- " 38332521 | \n",
- " 19072246 | \n",
- " 19260275 | \n",
+ " 05000US47095 | \n",
+ " Lake County, TN | \n",
+ " 7773 | \n",
+ " 4897 | \n",
+ " 2876 | \n",
+ " 0.630001 | \n",
"
\n",
" \n",
- " 04000US48 | \n",
- " Texas | \n",
- " 26448193 | \n",
- " 13145494 | \n",
- " 13302699 | \n",
+ " 05000US47129 | \n",
+ " Morgan County, TN | \n",
+ " 21964 | \n",
+ " 12126 | \n",
+ " 9838 | \n",
+ " 0.552085 | \n",
"
\n",
" \n",
- " 04000US12 | \n",
- " Florida | \n",
- " 19552860 | \n",
- " 9565609 | \n",
- " 9987251 | \n",
+ " 05000US47181 | \n",
+ " Wayne County, TN | \n",
+ " 16996 | \n",
+ " 9370 | \n",
+ " 7626 | \n",
+ " 0.551306 | \n",
"
\n",
" \n",
- " 04000US36 | \n",
- " New York | \n",
- " 19651127 | \n",
- " 9536179 | \n",
- " 10114948 | \n",
+ " 05000US47069 | \n",
+ " Hardeman County, TN | \n",
+ " 26897 | \n",
+ " 14670 | \n",
+ " 12227 | \n",
+ " 0.545414 | \n",
"
\n",
" \n",
- " 04000US17 | \n",
- " Illinois | \n",
- " 12882135 | \n",
- " 6326778 | \n",
- " 6555357 | \n",
+ " 05000US47007 | \n",
+ " Bledsoe County, TN | \n",
+ " 12853 | \n",
+ " 6951 | \n",
+ " 5902 | \n",
+ " 0.540808 | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " name Total Male Female\n",
- "04000US06 California 38332521 19072246 19260275\n",
- "04000US48 Texas 26448193 13145494 13302699\n",
- "04000US12 Florida 19552860 9565609 9987251\n",
- "04000US36 New York 19651127 9536179 10114948\n",
- "04000US17 Illinois 12882135 6326778 6555357"
+ " name Total Male Female pct_male\n",
+ "05000US47095 Lake County, TN 7773 4897 2876 0.630001\n",
+ "05000US47129 Morgan County, TN 21964 12126 9838 0.552085\n",
+ "05000US47181 Wayne County, TN 16996 9370 7626 0.551306\n",
+ "05000US47069 Hardeman County, TN 26897 14670 12227 0.545414\n",
+ "05000US47007 Bledsoe County, TN 12853 6951 5902 0.540808"
]
},
- "execution_count": 5,
+ "execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "df.sort('Male',ascending=False).head(5)"
+ "df = get_dataframe(tables='B01001',geoids='050|04000US47',column_names=True,level=1)\n",
+ "df['pct_male'] = df['Male'] / df['Total']\n",
+ "df.sort('pct_male',ascending=False).head(5)"
]
}
],