{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Zip code distribution analysis for \"geochunk\" algorithm\n", "\n", "Our goal is to group zip codes by variable length prefixes in such a way that the chunk sizes tend to be roughly equal, with no giant, leftover chunks.\n", "\n", "But first, we need to import some standard Python data libraries." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We have some zip code census data from [this blog post](https://blog.splitwise.com/2013/09/18/the-2010-us-census-population-by-zip-code-totally-free/) that we want to load and examine. We need to do this `np.object_` business to force the CSV parser to treat zip codes as strings, and not as integers (thus losing the leading zeroes)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Code ZCTA2010 Census Population
00100116769
10100229049
20100310372
3010055079
40100714649
5010081263
601009741
7010103609
8010111370
901012661
\n", "
" ], "text/plain": [ " Zip Code ZCTA 2010 Census Population\n", "0 01001 16769\n", "1 01002 29049\n", "2 01003 10372\n", "3 01005 5079\n", "4 01007 14649\n", "5 01008 1263\n", "6 01009 741\n", "7 01010 3609\n", "8 01011 1370\n", "9 01012 661" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zippop = pd.read_csv('../src/zip2010.csv', dtype={'Zip Code ZCTA': np.object_, '2010 Census Population': np.int32})\n", "zippop[:10]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "308739931" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pop = zippop['2010 Census Population']\n", "pop.sum()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's look at the distribution of population by zip code." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAEWCAYAAACufwpNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmYHVW57/Hvz0RmJAlpOJkkUQLXwEGEFoKoF0GTMGjw\nHPQEB8JwzUXxKE4QnIIKCh6PCFcFIwTCIAEZJCKYEyaVcyHQYYYQaUIgHQNpSBickMB7/qi1odLs\nvXunU3vv7M7v8zz76aq3VlWt1QV5e1WtvUoRgZmZWRHe0OwKmJlZ/+GkYmZmhXFSMTOzwjipmJlZ\nYZxUzMysME4qZmZWGCcV2yhI2k9S13rsf46kbxRZJ8tICkk7NrseVgwnFWs4SUsl/U3SnyU9JekC\nSVs1u14lko6UdGs+FhHHRsR3mlWnvpD05vQ77vlZI+mmVOZkSRfn9glJf0nllkv6oaQBzWuFtRon\nFWuWD0bEVsAeQDvw9SbXp+VJGphfj4gnImKr/Ad4F/A34LtVDvX2VPYA4GPAp+pWaet3nFSsqSJi\nOXA9sCuApOGS5kpaJalT0qv/oKW/qq+QdJmkFyTdJentue1r3UZJPaBTyp1X0nRJj6bjPCTpwyn+\nNuAcYJ/01/qz5Y4l6VOpfqtSfYf3qMexkh6R9Kykn0hShXr01qbhkq6U1C3pMUmfK7PvxZKeB46s\n9ruW9CbgCuD0iLihWlmAiHgY+APp2pQ53i6S5qffwVOSvprim0r6kaQ/pc+PJG2a2+8rklakbUf3\nOOamkn4g6Yl0zHMkbd5bXW3D4aRiTSVp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/+uxjZmTitk6SPNUHQjcL2lP4Chgb7J3ZHxK0jtS0Z2Bn0bE24Dnyd4fUqtbgfGR\nTTg5BzghIpaSvY/kjNRj+kOPfS4EToyI3ci+3T0jt21gROwFHN8jblY4JxWz2mwu6R6y6VWeIJtr\n7d3A1RHxl4j4M9kkiqWewLKI+O+0fHEqW6uRwDxJ9wNfAXapVljSNsCgiPhdCs0me9lUSWmC0YVk\n7woxq5uBvRcxM9IzlXxA1d/S23P+o9L6Gl77Y26zCvv+P+CHETFX0n7AyetU09d7Mf18Gf8/b3Xm\nnopZ3/0BODTNzLsl8OEUA3izpH3S8sfIbmkBLAX2TMv/WuG42/DalOhTc/EXyF4XvZaIeA5YnXte\n8kngdz3LmTWCk4pZH0XEXcAFZLPsLgDOjYi70+bFwHGSFpHNQnx2in8LOFNSB1nPoZyTgV9KWkj2\nmt2SXwMfLj2o77HPVOA/JN1HNgvyt9enbWZ95VmKzQqWRmpdm4Yfm21U3FMxM7PCuKdiZmaFcU/F\nzMwK46RiZmaFcVIxM7PCOKmYmVlhnFTMzKww/wMvrP33ydaj+QAAAABJRU5ErkJggg==\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.hist(pop, bins=50)\n", "plt.title(\"Population per ZIP code\")\n", "plt.xlabel(\"Population\")\n", "plt.ylabel(\"# of ZIP codes\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Code ZCTA2010 Census Population
2064060629113916
2772779936111086
274811368109931
3010990650105549
2998690011103892
3019291331103689
272011226101572
3004590201101279
275311373100820
27141122099598
27591138598592
25271046797060
304609233595397
266717708495137
24511002594600
27021120894469
300759028094396
267737744994382
27291123693877
271927852193818
\n", "
" ], "text/plain": [ " Zip Code ZCTA 2010 Census Population\n", "20640 60629 113916\n", "27727 79936 111086\n", "2748 11368 109931\n", "30109 90650 105549\n", "29986 90011 103892\n", "30192 91331 103689\n", "2720 11226 101572\n", "30045 90201 101279\n", "2753 11373 100820\n", "2714 11220 99598\n", "2759 11385 98592\n", "2527 10467 97060\n", "30460 92335 95397\n", "26671 77084 95137\n", "2451 10025 94600\n", "2702 11208 94469\n", "30075 90280 94396\n", "26773 77449 94382\n", "2729 11236 93877\n", "27192 78521 93818" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zippop.nlargest(20, '2010 Census Population')" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Code ZCTA2010 Census Population
75011990
383022030
1423054810
1558060200
1580060590
\n", "
" ], "text/plain": [ " Zip Code ZCTA 2010 Census Population\n", "75 01199 0\n", "383 02203 0\n", "1423 05481 0\n", "1558 06020 0\n", "1580 06059 0" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zippop.nsmallest(5, '2010 Census Population')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now let's look at 4-digit zip code prefixes:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Prefix2010 Census Population
5331121710148
5341122621986
4981046605938
37736062605797
5351123588379
5321120584187
4971045560238
37726061543914
4811002505290
37746063497137
\n", "
" ], "text/plain": [ " Zip Prefix 2010 Census Population\n", "533 1121 710148\n", "534 1122 621986\n", "498 1046 605938\n", "3773 6062 605797\n", "535 1123 588379\n", "532 1120 584187\n", "497 1045 560238\n", "3772 6061 543914\n", "481 1002 505290\n", "3774 6063 497137" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def sum_by_zip_prefix(zippop, length):\n", " prefixes = zippop['Zip Code ZCTA'].str[:length].rename('Zip Prefix')\n", " df = pd.concat([prefixes, zippop['2010 Census Population']], axis=1)\n", " return df.groupby('Zip Prefix').sum().reset_index()\n", "prefix_4 = sum_by_zip_prefix(zippop, 4)\n", "prefix_4.nlargest(10, '2010 Census Population')" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAEWCAYAAACe8xtsAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcH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0MPCJpL+B4ssu7jwZOlLRHqroL\n8F8R8R6ym/l8qcBm7gFGR3YBv6uB0yJiAdk9Nn6aWkB3d1rmcuD0iNid7FfGZ+XmDYyIvcluKHQW\nZnXk5GG2tk2VXdK9Hfgb2XW99gNuiohXI+LvwI1A6ch+YUT8OU1fkerWaihwm6RHgK8C761WWdKW\nwFYRcWcquozspmIlpYtWziC7V4xZ3QzsuorZBuX1yC7pvlp2TbmKOl/fp/R6FWsOzjapsOzPgHMj\nYpqkMcCkQpGua2V6fhP/b1udueVh1rW7gSMkbZauKntkKgMYLmmfNP1psq4oyO68t1ea/mSF9W7J\nmktkH5srf4Xslr9riYiXgRdz5zM+B9zZuZ5ZX3DyMOtCRMwELiW7Eu0DwMUR8XCaPY/s5khzya7e\nekEq/xa7Vv4aAAAAaElEQVRwnqR2spZAOZOA6yTNILs1bMlvgCNLJ8w7LXMs8CNJs8muHvvtnrw3\ns+7yVXXNuimNjPptGtZrtkFxy8PMzApzy8PMzApzy8PMzApz8jAzs8KcPMzMrDAnDzMzK8zJw8zM\nCvv/3Fm3sH/MEGgAAAAASUVORK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.hist(prefix_4['2010 Census Population'], bins=50)\n", "plt.title(\"Population per 4-digit ZIP prefix\")\n", "plt.xlabel(\"Population\")\n", "plt.ylabel(\"# of Prefixes\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And various shorter prefix lengths. We tried to use 3-digit prefixes for the first Pachynorm run, which as you can, gave us some huge chunks with just under 3 million people." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Prefix2010 Census Population
6997702906700
5556062680484
911122504700
8039002404395
8439452274102
2763002177710
6797502079278
8189171924074
3063311885845
590701683417
\n", "
" ], "text/plain": [ " Zip Prefix 2010 Census Population\n", "699 770 2906700\n", "555 606 2680484\n", "91 112 2504700\n", "803 900 2404395\n", "843 945 2274102\n", "276 300 2177710\n", "679 750 2079278\n", "818 917 1924074\n", "306 331 1885845\n", "59 070 1683417" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prefix_3 = sum_by_zip_prefix(zippop, 3)\n", "prefix_3.nlargest(10, '2010 Census Population')" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAEWCAYAAACufwpNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHu9JREFUeJzt3XucZOO97/HP14w7McY0GXNJu8whtiNMOjIOyXHCdk+Q\niBBh3DLHDkdEshlyIfskws4Om9zHJUjEnSCX4xYSEpf0MBiGGAxmzJgeDIKN4Xf+WE9T06qqq6vW\nqurq/r5fr3rVqmc9a63f06u6fvU8a9VaigjMzMzysEKrAzAzs6HDScXMzHLjpGJmZrlxUjEzs9w4\nqZiZWW6cVMzMLDdOKpY7SdtLmt/A8j+T9M08Y2oHkg6WdHvJ639I2rDGZWuu224kfUfSEkmLJE1M\nbR3R6risPCeVIU7SPEmvpX/EZyWdL2mNVsfVq+8HKUBEHBER/7dVMdVL0lckPS7pJUnPSDpD0sh6\n1xcRa0TE4wOtm/bxd6rEeWJ6P5Q+XpEUkg5KdeZJ2jFNHyzprVTvJUmzJO1Rb7sGQtJE4KvAZhHx\n/oh4KrX1rWZs3wb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7cBGwNIOjb1XmZLOiaVdUp6WNJFkuZIuqK3Z6PsHjhj0nSXpFv7rlzSJ5Xdh+Je\nSTdJWk/ZxQ+PAL6SekwfU3YPkK+lZbaUdKeyCyJerXfvPXKrpNOU3XPj75I+Vvyfx2xgnFRs2ErX\nMtoVeEDSh4FDyC41PgX4oqStUtVNgJ9ExAeBl8juMVGr24EpEbEVcAlwXETMI7tnxRmpx3Rbn2Uu\nBI6PiC3Ifhl+Usm8kRGxNXBMn3KzQcFJxYajVZVdXrwbeIrs+lHbAVdHxCsR8Q/gKqC3J/B0RPwl\nTf8q1a3VeOB6SQ8A/wr8U7XKktYCRkXEn1LRBWQ3C+vVexHImWT3ejEbVEb2X8VsyHktssuLvyO7\nNmFFfa9l1Pt6Ge9+MVulwrI/BE6PiGslbU92A6lGvJ6e38L/vzYIuadilrkN2EvSaulK0XunMoCJ\nkrZJ058nG9KC7G6dH07Tn6mw3rV49zLiU0vKXya7Be5yIuJF4IWS4yUHAn/qW89ssHJSMQMi4h7g\nfLIrsd4FnBMR96bZj5DdOG0O2T3Zf5rKvw2cKambrOdQzsnA5ZJmkt2Ktdd1wN69B+r7LDMV+L6k\n+8luNPVvjbTNrJl8lWKzKtKZWr9Npx+bWT/cUzEzs9y4p2JmZrlxT8XMzHLjpGJmZrlxUjEzs9w4\nqZiZWW6cVMzMLDf/H7nT5MpRysfwAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.hist(prefix_3['2010 Census Population'], bins=50)\n", "plt.title(\"Population per 3-digit ZIP prefix\")\n", "plt.xlabel(\"Population\")\n", "plt.ylabel(\"# of Prefixes\")" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Prefix2010 Census Population
31339285786
90929033701
58608783167
9117579159
28307254703
75777012758
93956786586
46486634334
76786358782
30326263654
\n", "
" ], "text/plain": [ " Zip Prefix 2010 Census Population\n", "31 33 9285786\n", "90 92 9033701\n", "58 60 8783167\n", "9 11 7579159\n", "28 30 7254703\n", "75 77 7012758\n", "93 95 6786586\n", "46 48 6634334\n", "76 78 6358782\n", "30 32 6263654" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prefix_2 = sum_by_zip_prefix(zippop, 2)\n", "prefix_2.nlargest(10, '2010 Census Population')" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Prefix2010 Census Population
6769184566
4951486400
8082520260
8688620867
405625741
8486644295
5658671781
2426795935
5557813464
7981832537
\n", "
" ], "text/plain": [ " Zip Prefix 2010 Census Population\n", "67 69 184566\n", "49 51 486400\n", "80 82 520260\n", "86 88 620867\n", "4 05 625741\n", "84 86 644295\n", "56 58 671781\n", "24 26 795935\n", "55 57 813464\n", "79 81 832537" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prefix_2.nsmallest(10, '2010 Census Population')" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGmtJREFUeJzt3Xm4HFWZx/HvDyKyRdarEsL1AjIIgyhwFRxAGYIDsrqg\nwrBFGDI4AjIqiIwKMzoIw4jjzkR2QVAQEEZn2ATZdwJCIoIQIBAMAcISUAi880edkE57u2/dpaty\n+/w+z9PP7a4+VfVW3e5+65yqOkcRgZmZ5WupugMwM7N6ORGYmWXOicDMLHNOBGZmmXMiMDPLnBOB\nmVnmnAhs2CRtI2nWCOY/SdJXRjOmsUDSZEnXNbx+QdI6JectXXaskfR1SXMlPSGpN23r0nXHlQMn\ngi4haaakl9KX54+STpe0Yt1xLdT84wcQEQdFxNfqimm4JB0u6R5Jz0t6SNLhI1leRKwYEQ8OtWz6\nH3+9TZxHpc9D42O+pJC0byozU9J26flkSa+mcs9JmiZp55FsW1mSeoHPAxtGxFsj4pG0ra9Wsf7c\nORF0l10iYkVgU6Af+HLN8Yx5ksYNNBnYF1gF2AE4WNIelQZWQkQcm35MX38A3wKmAz9vMduNqdzK\nwCnAzyStMpI4VBjst6YXeCoi5oxkXTY8TgRdKCIeA/4X2AhA0gRJF0t6WtIDkg5cWFbSMZLOl/TT\ndIR7h6R3Nbwfkt7e8LrlUaikIyX9IS1nuqSPpOkbACcB70tHm/MGWpakA1N8T6d4JzTFcZCk+yXN\nk/R9SWoRx2DbNEHSzyU9mY7oDx1g3rMkPQdMHmD//kdE3BERCyLiPuAXwJat/h+SVkvb85ykW4B1\nm95/fR+nspeksrem5pLrmstKmgLsBRyR9uklrdbfMO+OwKHA7hExv13ZiHgNOBVYrjnetKzJkq6X\n9D1Jz0r6naRJDe9fLenfJV0PvAisI2klSadImi3psbRtS6cayeXAhLQtp0vqS9s6TtKqkmZ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\nHV4fp+Ge9DgsTeuT9DtJZ0uaIel8Scun92amu3CR1C/p6uaFS9oljX9xp6QrJL0ljYVxEPDPqdq+\ntaRjJH0hzfPu1PHb3ZIulLRKmn61pOMl3ZKq+lt3fvfYGDAVOCQiNgO+APyg8c003sjawK+HumAn\nAut6qc+pDwG/lbQZ8Clgc4o+hw5MXXEArA/8ICI2AJ6jGNuirOuALSJiE4ouj4+IiJnAScC3Us3k\n2qZ5zgS+GBEbUzRhHd3w3riIeC9wWNN0y5CkFSlqludJmkbRdcwaTcX2AM6PiFeHunwnAutmy6Uv\nzW0U/cqcAmwFXBgR8yPiBeACYOER96MRcX16flYqW9ZE4FJJvwUOB/66XWFJKwErR8Rv0qQzgPc3\nFLkg/b0d6BtCHNadlgLmpQOKhY8NmsrswTCahRYu3KxbvdTwpTkkDVDSTvOVEwtfL2DRd2XZFvN+\nF/heRLwT+Mc25cpa2FPsq7i7+OxFxHPAQ5I+DqDCuxa+n84XrALcOJzlOxFYbq4FPixpeUkrAB9J\n0wB6U7/0AH9P0dwDMBPYLD3/WIvlrsSibo73a5j+PEU32IuJiGeBZxra//cBftNczvIk6RyKH/X1\nJc2SdACwF3BA6iTvXhYfcW0P4NzhdprnIw3LSkTcIel04JY06eSIuDOd2L0P+IykU4HpwA9TmX8F\nTpH0NeDqFos+hqL99hmKk3Vrp+mXAOdL2o2/HAFrP+CkdFL6QYpzF2ZExJ4t3hpwRLmIOGYk6/N9\nBGYUVw0B/zOUa7bNuoWbhszMMucagZlZ5lwjMDPLnBOBmVnmnAjMzDLnRGBmljknAjOzzP0/zqUB\nf18naXoAAAAASUVORK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.hist(prefix_2['2010 Census Population'], bins=20)\n", "plt.title(\"Population per 2-digit ZIP prefix\")\n", "plt.xlabel(\"Population\")\n", "plt.ylabel(\"# of Prefixes\")" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Zip Prefix2010 Census Population
0023236989
1132978141
2230390138
3342575790
4432249466
5516513346
6623499661
7736345281
8821075552
9949875567
\n", "
" ], "text/plain": [ " Zip Prefix 2010 Census Population\n", "0 0 23236989\n", "1 1 32978141\n", "2 2 30390138\n", "3 3 42575790\n", "4 4 32249466\n", "5 5 16513346\n", "6 6 23499661\n", "7 7 36345281\n", "8 8 21075552\n", "9 9 49875567" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sum_by_zip_prefix(zippop, 1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Variable length chunks\n", "\n", "Now that we've explored the data, we're ready to experiment with variable length chunks. First, we want to build a table that will allow us to quickly look up the population of any prefix from length 0 (the entire country) to length 5 (a single zip)." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[2906700, 10538]" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "prefix_populations = [ sum_by_zip_prefix(zippop, prefix).set_index('Zip Prefix') for prefix in range(0,6) ]\n", "def prefix_population(prefix):\n", " return prefix_populations[len(prefix)]['2010 Census Population'].get(prefix, 0)\n", "[prefix_population('770'), prefix_population('03755')]" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['9020',\n", " '9021',\n", " '9022',\n", " '9023',\n", " '9024',\n", " '9025',\n", " '9026',\n", " '9027',\n", " '9028',\n", " '9029']" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def sub_prefixes(prefix):\n", " return [ prefix + str(n) for n in range(0,10) ]\n", "sub_prefixes('902')" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
2010 Census PopulationPrefixes
Chunk
010_077922[0100]
010_196062[0101, 0102]
010_276753[0103, 0104]
010_373002[0105, 0106]
010_437535[0107]
010_588283[0108]
010_619818[0109]
0110_092014[01100, 01101, 01102, 01103, 01104, 01105, 011...
0110_130250[01109]
011_046571[0111, 0112, 0113, 0114, 0115, 0116, 0117, 011...
012_089837[0120, 0121, 0122, 0123]
012_140852[0124, 0125, 0126, 0127, 0128, 0129]
014_082626[0140, 0141, 0142, 0143, 0144]
014_160658[0145]
014_268528[0146, 0147, 0148, 0149]
015_082551[0150, 0151]
015_185393[0152, 0153]
015_276897[0154, 0155]
015_379853[0156, 0157]
015_449025[0158, 0159]
0160_077412[01600, 01601, 01602, 01603, 01604]
0160_179958[01605, 01606, 01607, 01608, 01609]
016_031032[0161, 0162, 0163, 0164, 0165, 0166, 0167, 016...
017_073888[0170, 0171]
017_152571[0172, 0173]
017_281318[0174]
017_382505[0175]
017_488745[0176, 0177, 0178, 0179]
0184_076383[01840, 01841, 01842, 01843]
0184_175601[01844, 01845, 01846, 01847, 01848, 01849]
.........
988_168451[9882, 9883]
988_258751[9884, 9885, 9886, 9887, 9888, 9889]
9890_091008[98900, 98901, 98902, 98903, 98904, 98905, 989...
9890_135240[98908, 98909]
989_077532[9891, 9892, 9893]
989_180875[9894, 9895, 9896, 9897, 9898, 9899]
990_082533[9900, 9901]
990_159475[9902, 9903, 9904, 9905, 9906, 9907, 9908, 9909]
991_067655[9910, 9911, 9912, 9913, 9914, 9915]
991_147583[9916, 9917, 9918, 9919]
9920_061795[99200, 99201, 99202, 99203, 99204]
9920_176939[99205, 99206]
9920_280047[99207, 99208, 99209]
992_076513[9921]
992_147562[9922, 9923, 9924, 9925, 9926, 9927, 9928, 9929]
993_099875[9930, 9931, 9932]
993_191450[9933]
993_233446[9934]
993_379378[9935]
993_444835[9936, 9937, 9938, 9939]
9950_097248[99500, 99501, 99502, 99503, 99504]
9950_187630[99505, 99506, 99507, 99508, 99509]
995_097276[9951, 9952, 9953, 9954, 9955, 9956]
995_138506[9957, 9958, 9959]
996_078544[9960, 9961, 9962, 9963, 9964]
996_189277[9965, 9966, 9967]
996_216262[9968, 9969]
997_096393[9970, 9971]
997_137796[9972, 9973, 9974, 9975, 9976, 9977, 9978, 9979]
99_092694[994, 998, 999]
\n", "

4444 rows × 2 columns

\n", "
" ], "text/plain": [ " 2010 Census Population \\\n", "Chunk \n", "010_0 77922 \n", "010_1 96062 \n", "010_2 76753 \n", "010_3 73002 \n", "010_4 37535 \n", "010_5 88283 \n", "010_6 19818 \n", "0110_0 92014 \n", "0110_1 30250 \n", "011_0 46571 \n", "012_0 89837 \n", "012_1 40852 \n", "014_0 82626 \n", "014_1 60658 \n", "014_2 68528 \n", "015_0 82551 \n", "015_1 85393 \n", "015_2 76897 \n", "015_3 79853 \n", "015_4 49025 \n", "0160_0 77412 \n", "0160_1 79958 \n", "016_0 31032 \n", "017_0 73888 \n", "017_1 52571 \n", "017_2 81318 \n", "017_3 82505 \n", "017_4 88745 \n", "0184_0 76383 \n", "0184_1 75601 \n", "... ... \n", "988_1 68451 \n", "988_2 58751 \n", "9890_0 91008 \n", "9890_1 35240 \n", "989_0 77532 \n", "989_1 80875 \n", "990_0 82533 \n", "990_1 59475 \n", "991_0 67655 \n", "991_1 47583 \n", "9920_0 61795 \n", "9920_1 76939 \n", "9920_2 80047 \n", "992_0 76513 \n", "992_1 47562 \n", "993_0 99875 \n", "993_1 91450 \n", "993_2 33446 \n", "993_3 79378 \n", "993_4 44835 \n", "9950_0 97248 \n", "9950_1 87630 \n", "995_0 97276 \n", "995_1 38506 \n", "996_0 78544 \n", "996_1 89277 \n", "996_2 16262 \n", "997_0 96393 \n", "997_1 37796 \n", "99_0 92694 \n", "\n", " Prefixes \n", "Chunk \n", "010_0 [0100] \n", "010_1 [0101, 0102] \n", "010_2 [0103, 0104] \n", "010_3 [0105, 0106] \n", "010_4 [0107] \n", "010_5 [0108] \n", "010_6 [0109] \n", "0110_0 [01100, 01101, 01102, 01103, 01104, 01105, 011... \n", "0110_1 [01109] \n", "011_0 [0111, 0112, 0113, 0114, 0115, 0116, 0117, 011... \n", "012_0 [0120, 0121, 0122, 0123] \n", "012_1 [0124, 0125, 0126, 0127, 0128, 0129] \n", "014_0 [0140, 0141, 0142, 0143, 0144] \n", "014_1 [0145] \n", "014_2 [0146, 0147, 0148, 0149] \n", "015_0 [0150, 0151] \n", "015_1 [0152, 0153] \n", "015_2 [0154, 0155] \n", "015_3 [0156, 0157] \n", "015_4 [0158, 0159] \n", "0160_0 [01600, 01601, 01602, 01603, 01604] \n", "0160_1 [01605, 01606, 01607, 01608, 01609] \n", "016_0 [0161, 0162, 0163, 0164, 0165, 0166, 0167, 016... \n", "017_0 [0170, 0171] \n", "017_1 [0172, 0173] \n", "017_2 [0174] \n", "017_3 [0175] \n", "017_4 [0176, 0177, 0178, 0179] \n", "0184_0 [01840, 01841, 01842, 01843] \n", "0184_1 [01844, 01845, 01846, 01847, 01848, 01849] \n", "... ... \n", "988_1 [9882, 9883] \n", "988_2 [9884, 9885, 9886, 9887, 9888, 9889] \n", "9890_0 [98900, 98901, 98902, 98903, 98904, 98905, 989... \n", "9890_1 [98908, 98909] \n", "989_0 [9891, 9892, 9893] \n", "989_1 [9894, 9895, 9896, 9897, 9898, 9899] \n", "990_0 [9900, 9901] \n", "990_1 [9902, 9903, 9904, 9905, 9906, 9907, 9908, 9909] \n", "991_0 [9910, 9911, 9912, 9913, 9914, 9915] \n", "991_1 [9916, 9917, 9918, 9919] \n", "9920_0 [99200, 99201, 99202, 99203, 99204] \n", "9920_1 [99205, 99206] \n", "9920_2 [99207, 99208, 99209] \n", "992_0 [9921] \n", "992_1 [9922, 9923, 9924, 9925, 9926, 9927, 9928, 9929] \n", "993_0 [9930, 9931, 9932] \n", "993_1 [9933] \n", "993_2 [9934] \n", "993_3 [9935] \n", "993_4 [9936, 9937, 9938, 9939] \n", "9950_0 [99500, 99501, 99502, 99503, 99504] \n", "9950_1 [99505, 99506, 99507, 99508, 99509] \n", "995_0 [9951, 9952, 9953, 9954, 9955, 9956] \n", "995_1 [9957, 9958, 9959] \n", "996_0 [9960, 9961, 9962, 9963, 9964] \n", "996_1 [9965, 9966, 9967] \n", "996_2 [9968, 9969] \n", "997_0 [9970, 9971] \n", "997_1 [9972, 9973, 9974, 9975, 9976, 9977, 9978, 9979] \n", "99_0 [994, 998, 999] \n", "\n", "[4444 rows x 2 columns]" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "class ZipChunk:\n", " \"A group of zip codes roughly equal in size to all other such chunks.\"\n", " \n", " def __init__(self, id):\n", " self.id = id\n", " self.prefixes = []\n", "\n", " def add_prefix(self, prefix):\n", " self.prefixes.append(prefix)\n", " \n", " def population(self):\n", " return sum([ prefix_population(prefix) for prefix in self.prefixes ])\n", " \n", "def build_chunks_recursive(population, chunks, prefix):\n", " lower_limit = population / 2\n", " upper_limit = population\n", " if lower_limit < prefix_population(prefix) <= upper_limit or len(prefix) >= 5:\n", " chunk = ZipChunk(prefix)\n", " chunk.add_prefix(prefix)\n", " chunks.append(chunk)\n", " else:\n", " leftovers = []\n", " for child in sub_prefixes(prefix): \n", " if prefix_population(child) >= upper_limit:\n", " build_chunks_recursive(population, chunks, child)\n", " else:\n", " leftovers.append(child)\n", " i = 0\n", " chunk = ZipChunk(\"%s_%i\" % (prefix, i))\n", " while len(leftovers) > 0:\n", " child = leftovers.pop(0)\n", " assert(prefix_population(child) <= upper_limit)\n", " if chunk.population() + prefix_population(child) > upper_limit:\n", " i += 1\n", " chunks.append(chunk)\n", " chunk = ZipChunk(\"%s_%i\" % (prefix, i))\n", " chunk.add_prefix(child)\n", " if chunk.population() > 0:\n", " chunks.append(chunk)\n", " \n", "def build_chunks(population):\n", " chunks = []\n", " build_chunks_recursive(population, chunks, '')\n", " chunks = sorted(chunks, key=lambda chunk: chunk.id)\n", " result = pd.DataFrame([ (chunk.id, chunk.population(), chunk.prefixes) for chunk in chunks ])\n", " result.columns = ['Chunk', '2010 Census Population', 'Prefixes']\n", " result.set_index('Chunk', inplace=True)\n", " return result\n", "\n", "chunks = build_chunks(100000)\n", "chunks" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEWCAYAAAB8LwAVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGo1JREFUeJzt3X28ZmVd7/HPV1BUMAGZaHhqUMlX5FHUiSDtHI6WKGbg\nQxwo5UGU7OgrKU8KZomWhafCoycPOIoJqeADgkSWCZpJKTaDJAiSowwy4wCDiuJDCPg7f6xry81m\n7b3vPcy973vv/Xm/XvfrXutaT7+1F8zvvq5rrWulqpAkaboHjDsASdJkMkFIknqZICRJvUwQkqRe\nJghJUi8ThCSplwlCS0qSQ5JsvB/bn5nkD7dlTJPg/v5d5tj3cUkuG8W+NV4mCI1Mkg1JfpDku0lu\nTvLuJDuNO64pff+wVdVLq+qPxxXT/ZHkwCQfTXJbkm8m+VyS48cdlxYvE4RG7dlVtRPwRGA18Nox\nx7PoJdm+p+xg4BPAp4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zzI+vBM2z7f4HTq+qiJIcAp84r0vu6\no33fjf//asSsQUidTwNHtBFMdwSe08oA9klycJv+DbpmI4ANwJPa9PNm2O/DuWcI6GMHym+ne53s\nvVTVt4FvDfQvvBD41PT1pIVggpCAqroCeDfdaKSXA++sqs+3xdcBL0tyLd1IrWe08tcDb0mylu4X\nfZ9TgQ8mWUf3Ks4pfws8Z6qTeto2xwJ/nuQLdCPFvuH+nJu0tRzNVZpFu+Po4nZLrLSsWIOQJPWy\nBiFJ6mUNQpLUywQhSeplgpAk9TJBSJJ6mSAkSb3+P6HC8/9lpHlRAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.hist(chunks['2010 Census Population'], bins=50)\n", "plt.title(\"Population per Chunk\")\n", "plt.xlabel(\"Population\")\n", "plt.ylabel(\"# of Chunks\")" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "308739931" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "chunks['2010 Census Population'].sum()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(4444, 2)" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "chunks.shape" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
2010 Census PopulationPrefixes
Chunk
010_0210857[0100, 0101, 0102, 0103]
010_1238700[0104, 0105, 0106, 0107, 0108]
010_219818[0109]
015_0244841[0150, 0151, 0152, 0153, 0154, 0155]
015_1128878[0156, 0157, 0158, 0159]
017_0207777[0170, 0171, 0172, 0173, 0174]
017_1171250[0175, 0176, 0177, 0178, 0179]
018_0184413[0180, 0181, 0182]
018_1227505[0183, 0184]
018_2210817[0185, 0186, 0187]
018_390391[0188, 0189]
019_0231079[0190, 0191, 0192]
019_1245235[0193, 0194, 0195, 0196, 0197, 0198, 0199]
01_0168835[011]
01_1213800[012, 013]
01_2211812[014]
01_3188402[016]
020_0184275[0200, 0201, 0202, 0203, 0204]
020_1216096[0205, 0206, 0207, 0208, 0209]
0212_0243585[02120, 02121, 02122, 02123, 02124, 02125, 021...
0212_116439[02129]
0213_0220173[02130, 02131, 02132, 02133, 02134, 02135, 021...
0213_136349[02139]
021_0136539[0210, 0211]
021_1207555[0214]
021_2220030[0215, 0216]
021_3203272[0217, 0218, 0219]
023_0241125[0230, 0231, 0232, 0233, 0234]
023_1199938[0235, 0236, 0237, 0238, 0239]
024_0242552[0240, 0241, 0242, 0243, 0244, 0245, 0246]
.........
981_3207457[9815, 9816, 9817, 9818, 9819]
982_0168159[9820, 9821]
982_1230928[9822, 9823]
982_2138281[9824, 9825, 9826]
982_3249350[9827, 9828]
982_490767[9829]
983_0240218[9830, 9831, 9832, 9833, 9834]
983_1148730[9835, 9836]
983_2162860[9837]
983_3161800[9838, 9839]
984_0214804[9840, 9841, 9842, 9843]
984_1185311[9844, 9845, 9846, 9847, 9848, 9849]
985_0241456[9850, 9851, 9852]
985_1234098[9853, 9854, 9855, 9856, 9857, 9858, 9859]
986_0227225[9860, 9861, 9862, 9863, 9864, 9865]
986_1191810[9866, 9867]
986_2154295[9868, 9869]
989_0203780[9890, 9891, 9892, 9893]
989_180875[9894, 9895, 9896, 9897, 9898, 9899]
98_0219761[987, 988]
992_0218781[9920]
992_1124075[9921, 9922, 9923, 9924, 9925, 9926, 9927, 992...
993_0224771[9930, 9931, 9932, 9933, 9934]
993_1124213[9935, 9936, 9937, 9938, 9939]
995_0184878[9950]
995_1135782[9951, 9952, 9953, 9954, 9955, 9956, 9957, 995...
99_0142008[990]
99_1136934[991, 994]
99_2184083[996]
99_3205187[997, 998, 999]
\n", "

1780 rows × 2 columns

\n", "
" ], "text/plain": [ " 2010 Census Population \\\n", "Chunk \n", "010_0 210857 \n", "010_1 238700 \n", "010_2 19818 \n", "015_0 244841 \n", "015_1 128878 \n", "017_0 207777 \n", "017_1 171250 \n", "018_0 184413 \n", "018_1 227505 \n", "018_2 210817 \n", "018_3 90391 \n", "019_0 231079 \n", "019_1 245235 \n", "01_0 168835 \n", "01_1 213800 \n", "01_2 211812 \n", "01_3 188402 \n", "020_0 184275 \n", "020_1 216096 \n", "0212_0 243585 \n", "0212_1 16439 \n", "0213_0 220173 \n", "0213_1 36349 \n", "021_0 136539 \n", "021_1 207555 \n", "021_2 220030 \n", "021_3 203272 \n", "023_0 241125 \n", "023_1 199938 \n", "024_0 242552 \n", "... ... \n", "981_3 207457 \n", "982_0 168159 \n", "982_1 230928 \n", "982_2 138281 \n", "982_3 249350 \n", "982_4 90767 \n", "983_0 240218 \n", "983_1 148730 \n", "983_2 162860 \n", "983_3 161800 \n", "984_0 214804 \n", "984_1 185311 \n", "985_0 241456 \n", "985_1 234098 \n", "986_0 227225 \n", "986_1 191810 \n", "986_2 154295 \n", "989_0 203780 \n", "989_1 80875 \n", "98_0 219761 \n", "992_0 218781 \n", "992_1 124075 \n", "993_0 224771 \n", "993_1 124213 \n", "995_0 184878 \n", "995_1 135782 \n", "99_0 142008 \n", "99_1 136934 \n", "99_2 184083 \n", "99_3 205187 \n", "\n", " Prefixes \n", "Chunk \n", "010_0 [0100, 0101, 0102, 0103] \n", "010_1 [0104, 0105, 0106, 0107, 0108] \n", "010_2 [0109] \n", "015_0 [0150, 0151, 0152, 0153, 0154, 0155] \n", "015_1 [0156, 0157, 0158, 0159] \n", "017_0 [0170, 0171, 0172, 0173, 0174] \n", "017_1 [0175, 0176, 0177, 0178, 0179] \n", "018_0 [0180, 0181, 0182] \n", "018_1 [0183, 0184] \n", "018_2 [0185, 0186, 0187] \n", "018_3 [0188, 0189] \n", "019_0 [0190, 0191, 0192] \n", "019_1 [0193, 0194, 0195, 0196, 0197, 0198, 0199] \n", "01_0 [011] \n", "01_1 [012, 013] \n", "01_2 [014] \n", "01_3 [016] \n", "020_0 [0200, 0201, 0202, 0203, 0204] \n", "020_1 [0205, 0206, 0207, 0208, 0209] \n", "0212_0 [02120, 02121, 02122, 02123, 02124, 02125, 021... \n", "0212_1 [02129] \n", "0213_0 [02130, 02131, 02132, 02133, 02134, 02135, 021... \n", "0213_1 [02139] \n", "021_0 [0210, 0211] \n", "021_1 [0214] \n", "021_2 [0215, 0216] \n", "021_3 [0217, 0218, 0219] \n", "023_0 [0230, 0231, 0232, 0233, 0234] \n", "023_1 [0235, 0236, 0237, 0238, 0239] \n", "024_0 [0240, 0241, 0242, 0243, 0244, 0245, 0246] \n", "... ... \n", "981_3 [9815, 9816, 9817, 9818, 9819] \n", "982_0 [9820, 9821] \n", "982_1 [9822, 9823] \n", "982_2 [9824, 9825, 9826] \n", "982_3 [9827, 9828] \n", "982_4 [9829] \n", "983_0 [9830, 9831, 9832, 9833, 9834] \n", "983_1 [9835, 9836] \n", "983_2 [9837] \n", "983_3 [9838, 9839] \n", "984_0 [9840, 9841, 9842, 9843] \n", "984_1 [9844, 9845, 9846, 9847, 9848, 9849] \n", "985_0 [9850, 9851, 9852] \n", "985_1 [9853, 9854, 9855, 9856, 9857, 9858, 9859] \n", "986_0 [9860, 9861, 9862, 9863, 9864, 9865] \n", "986_1 [9866, 9867] \n", "986_2 [9868, 9869] \n", "989_0 [9890, 9891, 9892, 9893] \n", "989_1 [9894, 9895, 9896, 9897, 9898, 9899] \n", "98_0 [987, 988] \n", "992_0 [9920] \n", "992_1 [9921, 9922, 9923, 9924, 9925, 9926, 9927, 992... \n", "993_0 [9930, 9931, 9932, 9933, 9934] \n", "993_1 [9935, 9936, 9937, 9938, 9939] \n", "995_0 [9950] \n", "995_1 [9951, 9952, 9953, 9954, 9955, 9956, 9957, 995... \n", "99_0 [990] \n", "99_1 [991, 994] \n", "99_2 [996] \n", "99_3 [997, 998, 999] \n", "\n", "[1780 rows x 2 columns]" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "chunks_250000 = build_chunks(250000)\n", "chunks_250000" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGw1JREFUeJzt3Xu4HFWd7vHvC4EgEElCMjEkxHA7KHrkFhEGVAYQBERA\nGA6oECLKwTMcRWeEgDhc9HFgdHB0hgNGQaIgKOHqZWTk+oA6MAmEa0AuJpCQhAQIBEQg8Dt/1GpS\nbLp7997Z1b13r/fzPP3s6lVrVa3V3bt/tVZVr1JEYGZm+Vqr0xUwM7POciAwM8ucA4GZWeYcCMzM\nMudAYGaWOQcCM7PMORBYv0jaXdLCNSh/vqSvDWSdBoM1fV162fbRkm7rQ/5tJM2WpCrq026Shkt6\nUNLYTtel2zgQdAFJ8yW9JOkFSUslXSRpw07Xq6beF1hEHBcRX+9UndaEpJ0k/VrSCknPSLpD0rRO\n16uOrwPfjohIX6IXSFogaaWkuZL2rWWUNFlSpM9Q7fG10vrhki6U9LykJZK+3GzHkr6U8j2fyg3v\nsa+bJP05fbHv1UrZiHgZuBCYPkCvjyUOBN3jgIjYENgBmAKc2uH6DHmShtVJ2wW4EbgF2BLYGPg8\nsG/PvJ0kaTzwN8DVKWkY8ATwYWAjis/HzyVN7lF0ZERsmB7lQH06sBXwzrTdEyV9tMG+96H4st4z\n5d8cOKOU5VLgLorX7qvArNpRfgtlfw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uAgSeun2V0PTmkAkyTtkpY/STHcA8Ud43ZMy4c02O5G\nrJ4GeGopfSXFrQrfJCKeA54tjf8fCdzSM59ZOzgQWFYi4k7gIopZGW8HfhgRd6XVD1HcCGgexT1x\nz0vpZwDflTSb4gi9ntOByyXNobg1YM0vgINrJ4t7lJkKfEvSPRQ3KjlzTdpm1l+efdSMN24n+Mt0\nqalZVtwjMDPLnHsEZmaZc4/AzCxzDgRmZplzIDAzy5wDgZlZ5hwIzMwy9/8BacD3vVNflwMAAAAA\nSUVORK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.hist(chunks_250000['2010 Census Population'], bins=50)\n", "plt.title(\"Population per Chunk (250,000)\")\n", "plt.xlabel(\"Population\")\n", "plt.ylabel(\"# of Chunks\")" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": true }, "outputs": [], "source": [ "chunks_250000.to_csv('geochunk_zip_250000.csv')" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
2010 Census PopulationPrefixes
Chunk
018_0411918[0180, 0181, 0182, 0183, 0184]
018_1301208[0185, 0186, 0187, 0188, 0189]
01_0469375[010]
01_1382635[011, 012, 013]
01_2211812[014]
01_3373719[015]
01_4188402[016]
01_5379027[017]
01_6476314[019]
021_0396563[0210, 0211, 0212]
021_1464077[0213, 0214]
021_2423302[0215, 0216, 0217, 0218, 0219]
027_0461337[0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277]
027_164999[0278, 0279]
028_0451970[0280, 0281, 0282, 0283, 0284, 0285, 0286, 0287]
028_1221007[0288, 0289]
02_0428586[020, 022]
02_1441063[023]
02_2408771[024]
02_3264504[025, 026]
02_4379604[029]
03_0377547[030]
03_1481457[031, 032, 033, 034]
03_2457569[035, 036, 037, 038]
03_348241[039]
04_0449276[040, 041]
04_1484241[042, 043, 044, 045]
04_2346497[046, 047, 048, 049]
05_0480908[050, 051, 052, 053, 054, 055, 056]
05_1144833[057, 058, 059]
.........
972_0392534[9720, 9721]
972_1449177[9722, 9723, 9724, 9725, 9726, 9727, 9728, 9729]
973_0462185[9730, 9731, 9732, 9733, 9734, 9735]
973_1135381[9736, 9737, 9738, 9739]
974_0394715[9740, 9741, 9742, 9743, 9744, 9745, 9746]
974_1161028[9747, 9748, 9749]
97_0319301[971]
97_1355650[975, 976]
97_2389914[977, 978, 979]
980_0341896[9800, 9801]
980_1226002[9802]
980_2382521[9803, 9804]
980_3398103[9805, 9806, 9807, 9808, 9809]
981_0428717[9810, 9811]
981_1432100[9812, 9813, 9814, 9815, 9816, 9817, 9818, 9819]
982_0447430[9820, 9821, 9822, 9823, 9824]
982_1430055[9825, 9826, 9827, 9828, 9829]
983_0388948[9830, 9831, 9832, 9833, 9834, 9835, 9836]
983_1324660[9837, 9838, 9839]
986_0419035[9860, 9861, 9862, 9863, 9864, 9865, 9866, 9867]
986_1154295[9868, 9869]
98_0400115[984]
98_1475554[985, 987]
98_2219761[988]
98_3284655[989]
99_0257246[990, 991]
99_1342856[992]
99_2370680[993, 994]
99_3320660[995]
99_4389270[996, 997, 998, 999]
\n", "

875 rows × 2 columns

\n", "
" ], "text/plain": [ " 2010 Census Population \\\n", "Chunk \n", "018_0 411918 \n", "018_1 301208 \n", "01_0 469375 \n", "01_1 382635 \n", "01_2 211812 \n", "01_3 373719 \n", "01_4 188402 \n", "01_5 379027 \n", "01_6 476314 \n", "021_0 396563 \n", "021_1 464077 \n", "021_2 423302 \n", "027_0 461337 \n", "027_1 64999 \n", "028_0 451970 \n", "028_1 221007 \n", "02_0 428586 \n", "02_1 441063 \n", "02_2 408771 \n", "02_3 264504 \n", "02_4 379604 \n", "03_0 377547 \n", "03_1 481457 \n", "03_2 457569 \n", "03_3 48241 \n", "04_0 449276 \n", "04_1 484241 \n", "04_2 346497 \n", "05_0 480908 \n", "05_1 144833 \n", "... ... \n", "972_0 392534 \n", "972_1 449177 \n", "973_0 462185 \n", "973_1 135381 \n", "974_0 394715 \n", "974_1 161028 \n", "97_0 319301 \n", "97_1 355650 \n", "97_2 389914 \n", "980_0 341896 \n", "980_1 226002 \n", "980_2 382521 \n", "980_3 398103 \n", "981_0 428717 \n", "981_1 432100 \n", "982_0 447430 \n", "982_1 430055 \n", "983_0 388948 \n", "983_1 324660 \n", "986_0 419035 \n", "986_1 154295 \n", "98_0 400115 \n", "98_1 475554 \n", "98_2 219761 \n", "98_3 284655 \n", "99_0 257246 \n", "99_1 342856 \n", "99_2 370680 \n", "99_3 320660 \n", "99_4 389270 \n", "\n", " Prefixes \n", "Chunk \n", "018_0 [0180, 0181, 0182, 0183, 0184] \n", "018_1 [0185, 0186, 0187, 0188, 0189] \n", "01_0 [010] \n", "01_1 [011, 012, 013] \n", "01_2 [014] \n", "01_3 [015] \n", "01_4 [016] \n", "01_5 [017] \n", "01_6 [019] \n", "021_0 [0210, 0211, 0212] \n", "021_1 [0213, 0214] \n", "021_2 [0215, 0216, 0217, 0218, 0219] \n", "027_0 [0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277] \n", "027_1 [0278, 0279] \n", "028_0 [0280, 0281, 0282, 0283, 0284, 0285, 0286, 0287] \n", "028_1 [0288, 0289] \n", "02_0 [020, 022] \n", "02_1 [023] \n", "02_2 [024] \n", "02_3 [025, 026] \n", "02_4 [029] \n", "03_0 [030] \n", "03_1 [031, 032, 033, 034] \n", "03_2 [035, 036, 037, 038] \n", "03_3 [039] \n", "04_0 [040, 041] \n", "04_1 [042, 043, 044, 045] \n", "04_2 [046, 047, 048, 049] \n", "05_0 [050, 051, 052, 053, 054, 055, 056] \n", "05_1 [057, 058, 059] \n", "... ... \n", "972_0 [9720, 9721] \n", "972_1 [9722, 9723, 9724, 9725, 9726, 9727, 9728, 9729] \n", "973_0 [9730, 9731, 9732, 9733, 9734, 9735] \n", "973_1 [9736, 9737, 9738, 9739] \n", "974_0 [9740, 9741, 9742, 9743, 9744, 9745, 9746] \n", "974_1 [9747, 9748, 9749] \n", "97_0 [971] \n", "97_1 [975, 976] \n", "97_2 [977, 978, 979] \n", "980_0 [9800, 9801] \n", "980_1 [9802] \n", "980_2 [9803, 9804] \n", "980_3 [9805, 9806, 9807, 9808, 9809] \n", "981_0 [9810, 9811] \n", "981_1 [9812, 9813, 9814, 9815, 9816, 9817, 9818, 9819] \n", "982_0 [9820, 9821, 9822, 9823, 9824] \n", "982_1 [9825, 9826, 9827, 9828, 9829] \n", "983_0 [9830, 9831, 9832, 9833, 9834, 9835, 9836] \n", "983_1 [9837, 9838, 9839] \n", "986_0 [9860, 9861, 9862, 9863, 9864, 9865, 9866, 9867] \n", "986_1 [9868, 9869] \n", "98_0 [984] \n", "98_1 [985, 987] \n", "98_2 [988] \n", "98_3 [989] \n", "99_0 [990, 991] \n", "99_1 [992] \n", "99_2 [993, 994] \n", "99_3 [995] \n", "99_4 [996, 997, 998, 999] \n", "\n", "[875 rows x 2 columns]" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "chunks_500000 = build_chunks(500000)\n", "chunks_500000" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAG8dJREFUeJzt3Xm4XFWZ7/HvjwBhSCCExBgIGB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ORK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.hist(chunks_500000['2010 Census Population'], bins=50)\n", "plt.title(\"Population per Chunk (500,000)\")\n", "plt.xlabel(\"Population\")\n", "plt.ylabel(\"# of Chunks\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 2 }