Skip to content

Commit

Permalink
Improve printing
Browse files Browse the repository at this point in the history
  • Loading branch information
brianspiering committed Mar 29, 2015
1 parent b0732db commit de33b54
Showing 1 changed file with 196 additions and 77 deletions.
273 changes: 196 additions & 77 deletions filter_census_tract_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
},
{
"cell_type": "code",
"execution_count": 288,
"execution_count": 309,
"metadata": {
"collapsed": false
},
Expand All @@ -484,89 +484,153 @@
"text": [
"Column key: \thc01_vc216\n",
"\n",
"Description: \tEstimate; COMPUTERS AND INTERNET USE - Total Households\n",
"Statistic type: Estimate\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc02_vc216\n",
"\n",
"Description: \tMargin of Error; COMPUTERS AND INTERNET USE - Total Households\n",
"Statistic type: Margin of Error\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc03_vc216\n",
"\n",
"Description: \tPercent; COMPUTERS AND INTERNET USE - Total Households\n",
"Statistic type: Percent\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc04_vc216\n",
"\n",
"Description: \tPercent Margin of Error; COMPUTERS AND INTERNET USE - Total Households\n",
"Statistic type: Percent Margin of Error\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc01_vc217\n",
"\n",
"Description: \tEstimate; COMPUTERS AND INTERNET USE - Total Households - With a computer\n",
"Statistic type: Estimate\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Computer\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc02_vc217\n",
"\n",
"Description: \tMargin of Error; COMPUTERS AND INTERNET USE - Total Households - With a computer\n",
"Statistic type: Margin of Error\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Computer\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc03_vc217\n",
"\n",
"Description: \tPercent; COMPUTERS AND INTERNET USE - Total Households - With a computer\n",
"Statistic type: Percent\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Computer\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc04_vc217\n",
"\n",
"Description: \tPercent Margin of Error; COMPUTERS AND INTERNET USE - Total Households - With a computer\n",
"Statistic type: Percent Margin of Error\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Computer\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc01_vc218\n",
"\n",
"Description: \tEstimate; COMPUTERS AND INTERNET USE - Total Households - With a broadband Internet subscription\n",
"Statistic type: Estimate\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Broadband Internet Subscription\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc02_vc218\n",
"\n",
"Description: \tMargin of Error; COMPUTERS AND INTERNET USE - Total Households - With a broadband Internet subscription\n",
"Statistic type: Margin of Error\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Broadband Internet Subscription\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc03_vc218\n",
"\n",
"Description: \tPercent; COMPUTERS AND INTERNET USE - Total Households - With a broadband Internet subscription\n",
"Statistic type: Percent\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Broadband Internet Subscription\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"***\n",
" \n",
"Column key: \thc04_vc218\n",
"\n",
"Description: \tPercent Margin of Error; COMPUTERS AND INTERNET USE - Total Households - With a broadband Internet subscription\n",
"Statistic type: Percent Margin of Error\n",
"\n",
"Statistic descriptions: \n",
"\t Computers And Internet Use \n",
"\t Total Households \n",
"\t With A Broadband Internet Subscription\n",
"\n",
"***\n",
" \n"
"--------------------------------------------------------------------------------\n",
"\n"
]
}
],
"source": [
"# Print the information\n",
"for key, value in df_selected.values:\n",
" print(\"\"\"Column key: \\t{}\\n\\nDescription: \\t{}\\n\\n***\n",
" \"\"\".format(key, value))"
" \n",
" print(\"Column key: \\t{}\\n\".format(key, value))\n",
" statistic_type, statistics_descriptions = value.split(\";\")\n",
" \n",
" print(\"Statistic type: {}\\n\".format(statistic_type))\n",
" print(\"Statistic descriptions: \")\n",
" \n",
" for statistic_description in statistics_descriptions.split(\"-\"):\n",
" print(\"\\t\"+statistic_description.title())\n",
" print(\"\\n\"+\"-\"*80+\"\\n\")"
]
},
{
"cell_type": "code",
"execution_count": 258,
"execution_count": 310,
"metadata": {
"collapsed": false
},
Expand All @@ -580,74 +644,129 @@
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>geo_display_label</th>\n",
" <th>hc01_vc135</th>\n",
" <th>hc02_vc135</th>\n",
" <th>hc03_vc135</th>\n",
" <th>hc04_vc135</th>\n",
" <th>hc01_vc216</th>\n",
" <th>hc02_vc216</th>\n",
" <th>hc03_vc216</th>\n",
" <th>hc04_vc216</th>\n",
" <th>hc01_vc217</th>\n",
" <th>hc02_vc217</th>\n",
" <th>hc03_vc217</th>\n",
" <th>hc04_vc217</th>\n",
" <th>hc01_vc218</th>\n",
" <th>hc02_vc218</th>\n",
" <th>hc03_vc218</th>\n",
" <th>hc04_vc218</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Census Tract 101, San Francisco County, Califo...</td>\n",
" <td>164</td>\n",
" <td>181</td>\n",
" <td>4.4</td>\n",
" <td>4.8</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Census Tract 102, San Francisco County, Califo...</td>\n",
" <td>57</td>\n",
" <td>51</td>\n",
" <td>1.4</td>\n",
" <td>1.3</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Census Tract 103, San Francisco County, Califo...</td>\n",
" <td>12</td>\n",
" <td>20</td>\n",
" <td>0.3</td>\n",
" <td>0.4</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Census Tract 104, San Francisco County, Califo...</td>\n",
" <td>102</td>\n",
" <td>98</td>\n",
" <td>2.0</td>\n",
" <td>1.9</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Census Tract 105, San Francisco County, Califo...</td>\n",
" <td>20</td>\n",
" <td>26</td>\n",
" <td>0.8</td>\n",
" <td>1.0</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" <td>(X)</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" geo_display_label hc01_vc135 hc02_vc135 \\\n",
"1 Census Tract 101, San Francisco County, Califo... 164 181 \n",
"2 Census Tract 102, San Francisco County, Califo... 57 51 \n",
"3 Census Tract 103, San Francisco County, Califo... 12 20 \n",
"4 Census Tract 104, San Francisco County, Califo... 102 98 \n",
"5 Census Tract 105, San Francisco County, Califo... 20 26 \n",
" geo_display_label hc01_vc216 hc02_vc216 \\\n",
"1 Census Tract 101, San Francisco County, Califo... (X) (X) \n",
"2 Census Tract 102, San Francisco County, Califo... (X) (X) \n",
"3 Census Tract 103, San Francisco County, Califo... (X) (X) \n",
"4 Census Tract 104, San Francisco County, Califo... (X) (X) \n",
"5 Census Tract 105, San Francisco County, Califo... (X) (X) \n",
"\n",
" hc03_vc216 hc04_vc216 hc01_vc217 hc02_vc217 hc03_vc217 hc04_vc217 \\\n",
"1 (X) (X) (X) (X) (X) (X) \n",
"2 (X) (X) (X) (X) (X) (X) \n",
"3 (X) (X) (X) (X) (X) (X) \n",
"4 (X) (X) (X) (X) (X) (X) \n",
"5 (X) (X) (X) (X) (X) (X) \n",
"\n",
" hc03_vc135 hc04_vc135 \n",
"1 4.4 4.8 \n",
"2 1.4 1.3 \n",
"3 0.3 0.4 \n",
"4 2.0 1.9 \n",
"5 0.8 1.0 "
" hc01_vc218 hc02_vc218 hc03_vc218 hc04_vc218 \n",
"1 (X) (X) (X) (X) \n",
"2 (X) (X) (X) (X) \n",
"3 (X) (X) (X) (X) \n",
"4 (X) (X) (X) (X) \n",
"5 (X) (X) (X) (X) "
]
},
"execution_count": 258,
"execution_count": 310,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit de33b54

Please sign in to comment.