{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "from synthpop.recipes.starter2 import Starter\n", "from synthpop.synthesizer import synthesize_all, enable_logging \n", "import os\n", "import pandas as pd\n", "#enable_logging()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [ { "ename": "KeyboardInterrupt", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n", "\u001b[1;32m\u001b[0m in \u001b[0;36msynthesize_counties\u001b[1;34m(counties)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0msynthesize_counties\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcounties\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mcounty\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mcounties\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mstarter\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mStarter\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0menviron\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"CENSUS\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"CA\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcounty\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[0msynthesize_all\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mstarter\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrun_line_magic\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'time'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'hh = synthesize_counties([\"Santa Clara County\", \"Solano County\", \"San Mateo County\", \"Marin County\", \"San Francisco County\", \"Napa County\", \"Sonoma County\", \"Contra Costa County\", \"Alameda County\"])'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\juan\\documents\\github\\synthpop\\synthpop\\recipes\\starter2.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, key, state, county, tract)\u001b[0m\n\u001b[0;32m 69\u001b[0m \u001b[0mblock_group_size_attr\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"B11005_001E\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 70\u001b[0m \u001b[0mtract_size_attr\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"B08201_001E\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 71\u001b[1;33m tract=tract)\n\u001b[0m\u001b[0;32m 72\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mh_acs\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mh_acs\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 73\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\juan\\documents\\github\\synthpop\\synthpop\\census_helpers.py\u001b[0m in \u001b[0;36mblock_group_and_tract_query\u001b[1;34m(self, block_group_columns, tract_columns, state, county, merge_columns, block_group_size_attr, tract_size_attr, tract, year)\u001b[0m\n\u001b[0;32m 110\u001b[0m tract_size_attr, tract=None, year=2016):\n\u001b[0;32m 111\u001b[0m df2 = self.tract_query(tract_columns, state, county, tract=tract,\n\u001b[1;32m--> 112\u001b[1;33m year=year)\n\u001b[0m\u001b[0;32m 113\u001b[0m df1 = self.block_group_query(block_group_columns, state, county,\n\u001b[0;32m 114\u001b[0m tract=tract, year=year)\n", "\u001b[1;32mc:\\users\\juan\\documents\\github\\synthpop\\synthpop\\census_helpers.py\u001b[0m in \u001b[0;36mtract_query\u001b[1;34m(self, census_columns, state, county, tract, year)\u001b[0m\n\u001b[0;32m 63\u001b[0m return self._query(census_columns, state, county,\n\u001b[0;32m 64\u001b[0m \u001b[0mforstr\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"tract:%s\"\u001b[0m \u001b[1;33m%\u001b[0m \u001b[0mtract\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 65\u001b[1;33m year=year)\n\u001b[0m\u001b[0;32m 66\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 67\u001b[0m def _query(self, census_columns, state, county, forstr,\n", "\u001b[1;32mc:\\users\\juan\\documents\\github\\synthpop\\synthpop\\census_helpers.py\u001b[0m in \u001b[0;36m_query\u001b[1;34m(self, census_columns, state, county, forstr, tract, year)\u001b[0m\n\u001b[0;32m 69\u001b[0m \u001b[0mc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mc\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 70\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 71\u001b[1;33m \u001b[0mstate\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcounty\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtry_fips_lookup\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mstate\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcounty\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 72\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 73\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mtract\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\juan\\documents\\github\\synthpop\\synthpop\\census_helpers.py\u001b[0m in \u001b[0;36mtry_fips_lookup\u001b[1;34m(self, state, county)\u001b[0m\n\u001b[0;32m 199\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 200\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mtry_fips_lookup\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstate\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcounty\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 201\u001b[1;33m \u001b[0mdf\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_fips_lookup\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 202\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 203\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mcounty\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\juan\\documents\\github\\synthpop\\synthpop\\census_helpers.py\u001b[0m in \u001b[0;36m_get_fips_lookup\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 143\u001b[0m },\n\u001b[0;32m 144\u001b[0m index_col=[\"State\",\n\u001b[1;32m--> 145\u001b[1;33m \"County Name\"]\n\u001b[0m\u001b[0;32m 146\u001b[0m )\n\u001b[0;32m 147\u001b[0m \u001b[1;32mdel\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfips_df\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"ANSI Cl\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36mparser_f\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, skip_footer, doublequote, delim_whitespace, as_recarray, compact_ints, use_unsigned, low_memory, buffer_lines, memory_map, float_precision)\u001b[0m\n\u001b[0;32m 707\u001b[0m skip_blank_lines=skip_blank_lines)\n\u001b[0;32m 708\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 709\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0m_read\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkwds\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 710\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 711\u001b[0m \u001b[0mparser_f\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__name__\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\site-packages\\pandas\\io\\parsers.py\u001b[0m in \u001b[0;36m_read\u001b[1;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[0;32m 431\u001b[0m \u001b[0mcompression\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_infer_compression\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcompression\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 432\u001b[0m filepath_or_buffer, _, compression = get_filepath_or_buffer(\n\u001b[1;32m--> 433\u001b[1;33m filepath_or_buffer, encoding, compression)\n\u001b[0m\u001b[0;32m 434\u001b[0m \u001b[0mkwds\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'compression'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcompression\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 435\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\site-packages\\pandas\\io\\common.py\u001b[0m in \u001b[0;36mget_filepath_or_buffer\u001b[1;34m(filepath_or_buffer, encoding, compression)\u001b[0m\n\u001b[0;32m 188\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 189\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0m_is_url\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 190\u001b[1;33m \u001b[0mreq\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_urlopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 191\u001b[0m \u001b[0mcontent_encoding\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mreq\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mheaders\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'Content-Encoding'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 192\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mcontent_encoding\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'gzip'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\urllib\\request.py\u001b[0m in \u001b[0;36murlopen\u001b[1;34m(url, data, timeout, cafile, capath, cadefault, context)\u001b[0m\n\u001b[0;32m 221\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 222\u001b[0m \u001b[0mopener\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_opener\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 223\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mopener\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0murl\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 224\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 225\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0minstall_opener\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mopener\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\urllib\\request.py\u001b[0m in \u001b[0;36mopen\u001b[1;34m(self, fullurl, data, timeout)\u001b[0m\n\u001b[0;32m 524\u001b[0m \u001b[0mreq\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmeth\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mreq\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 525\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 526\u001b[1;33m \u001b[0mresponse\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_open\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mreq\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdata\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 527\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 528\u001b[0m \u001b[1;31m# post-process response\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\urllib\\request.py\u001b[0m in \u001b[0;36m_open\u001b[1;34m(self, req, data)\u001b[0m\n\u001b[0;32m 542\u001b[0m \u001b[0mprotocol\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mreq\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtype\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 543\u001b[0m result = self._call_chain(self.handle_open, protocol, protocol +\n\u001b[1;32m--> 544\u001b[1;33m '_open', req)\n\u001b[0m\u001b[0;32m 545\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mresult\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 546\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\urllib\\request.py\u001b[0m in \u001b[0;36m_call_chain\u001b[1;34m(self, chain, kind, meth_name, *args)\u001b[0m\n\u001b[0;32m 502\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mhandler\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mhandlers\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 503\u001b[0m \u001b[0mfunc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mhandler\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmeth_name\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 504\u001b[1;33m \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mfunc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 505\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mresult\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 506\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\urllib\\request.py\u001b[0m in \u001b[0;36mhttps_open\u001b[1;34m(self, req)\u001b[0m\n\u001b[0;32m 1359\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mhttps_open\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mreq\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1360\u001b[0m return self.do_open(http.client.HTTPSConnection, req,\n\u001b[1;32m-> 1361\u001b[1;33m context=self._context, check_hostname=self._check_hostname)\n\u001b[0m\u001b[0;32m 1362\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1363\u001b[0m \u001b[0mhttps_request\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mAbstractHTTPHandler\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdo_request_\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\urllib\\request.py\u001b[0m in \u001b[0;36mdo_open\u001b[1;34m(self, http_class, req, **http_conn_args)\u001b[0m\n\u001b[0;32m 1319\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mOSError\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# timeout error\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1320\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mURLError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0merr\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1321\u001b[1;33m \u001b[0mr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgetresponse\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1322\u001b[0m \u001b[1;32mexcept\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1323\u001b[0m \u001b[0mh\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\http\\client.py\u001b[0m in \u001b[0;36mgetresponse\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1329\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1330\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1331\u001b[1;33m \u001b[0mresponse\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mbegin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1332\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mConnectionError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1333\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\http\\client.py\u001b[0m in \u001b[0;36mbegin\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 295\u001b[0m \u001b[1;31m# read until we get a non-100 response\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 296\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 297\u001b[1;33m \u001b[0mversion\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstatus\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mreason\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_read_status\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 298\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mstatus\u001b[0m \u001b[1;33m!=\u001b[0m \u001b[0mCONTINUE\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 299\u001b[0m \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\http\\client.py\u001b[0m in \u001b[0;36m_read_status\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 256\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 257\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_read_status\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 258\u001b[1;33m \u001b[0mline\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mstr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m_MAXLINE\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"iso-8859-1\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 259\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mline\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m>\u001b[0m \u001b[0m_MAXLINE\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 260\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mLineTooLong\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"status line\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\socket.py\u001b[0m in \u001b[0;36mreadinto\u001b[1;34m(self, b)\u001b[0m\n\u001b[0;32m 584\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 585\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 586\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_sock\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrecv_into\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 587\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 588\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_timeout_occurred\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\ssl.py\u001b[0m in \u001b[0;36mrecv_into\u001b[1;34m(self, buffer, nbytes, flags)\u001b[0m\n\u001b[0;32m 1007\u001b[0m \u001b[1;34m\"non-zero flags not allowed in calls to recv_into() on %s\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1008\u001b[0m self.__class__)\n\u001b[1;32m-> 1009\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnbytes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1010\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1011\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0msocket\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrecv_into\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnbytes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mflags\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\ssl.py\u001b[0m in \u001b[0;36mread\u001b[1;34m(self, len, buffer)\u001b[0m\n\u001b[0;32m 869\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Read on closed or unwrapped SSL socket.\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 870\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 871\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 872\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mSSLError\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 873\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m==\u001b[0m \u001b[0mSSL_ERROR_EOF\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msuppress_ragged_eofs\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\synpop_py3\\lib\\ssl.py\u001b[0m in \u001b[0;36mread\u001b[1;34m(self, len, buffer)\u001b[0m\n\u001b[0;32m 629\u001b[0m \"\"\"\n\u001b[0;32m 630\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mbuffer\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 631\u001b[1;33m \u001b[0mv\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 632\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 633\u001b[0m \u001b[0mv\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ "def synthesize_counties(counties):\n", " for county in counties:\n", " starter = Starter(os.environ[\"CENSUS\"], \"CA\", county)\n", " synthesize_all(starter)\n", "%time hh = synthesize_counties([\"Santa Clara County\", \"Solano County\", \"San Mateo County\", \"Marin County\", \"San Francisco County\", \"Napa County\", \"Sonoma County\", \"Contra Costa County\", \"Alameda County\"]) " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "starter = Starter(os.environ[\"CENSUS\"], \"CA\", \"Santa Clara County\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Synthesizing at geog level: 'block_group' (number of geographies is 1075)\n", "Synthesizing geog id:\n", " state 06\n", "county 085\n", "tract 508203\n", "block group 3\n", "dtype: object\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "c:\\users\\juan\\documents\\github\\synthpop\\synthpop\\ipu\\ipu.py:190: RuntimeWarning: divide by zero encountered in double_scalars\n", " adj = constraint / (column * weights).sum()\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Drawing 770 households\n" ] }, { "data": { "text/plain": [ "( serialno RT puma00 puma10 NP TYPE BLD TEN VEH HINCP \\\n", " 0 2009001096088 H 2702 -9 4 1 3.0 3.0 0.0 226400.0 \n", " 1 2009000797707 H 2702 -9 1 1 6.0 3.0 1.0 120000.0 \n", " 2 2009000776447 H 2702 -9 1 1 9.0 3.0 1.0 187000.0 \n", " 3 2009000034504 H 2702 -9 1 1 7.0 3.0 1.0 416000.0 \n", " 4 2012000837531 H -9 8502 1 1 8.0 3.0 1.0 57000.0 \n", " 5 2013000119247 H -9 8502 1 1 3.0 1.0 1.0 92000.0 \n", " 6 2010000191477 H 2702 -9 1 1 3.0 4.0 1.0 390.0 \n", " 7 2013000718037 H -9 8502 1 1 8.0 3.0 1.0 15500.0 \n", " 8 2010000285540 H 2702 -9 2 1 5.0 3.0 1.0 0.0 \n", " 9 2010000337473 H 2702 -9 4 1 8.0 3.0 1.0 32900.0 \n", " 10 2010001167857 H 2702 -9 3 1 5.0 3.0 1.0 81200.0 \n", " 11 2009001316324 H 2702 -9 2 1 5.0 3.0 1.0 4200.0 \n", " 12 2009001316324 H 2702 -9 2 1 5.0 3.0 1.0 4200.0 \n", " 13 2010000309566 H 2702 -9 3 1 3.0 3.0 2.0 110990.0 \n", " 14 2009000875809 H 2702 -9 4 1 2.0 1.0 5.0 202000.0 \n", " 15 2009000847427 H 2702 -9 3 1 2.0 1.0 3.0 192000.0 \n", " 16 2009000842508 H 2702 -9 2 1 2.0 2.0 2.0 168000.0 \n", " 17 2009001302282 H 2702 -9 2 1 3.0 2.0 2.0 150000.0 \n", " 18 2009000938159 H 2702 -9 2 1 9.0 3.0 2.0 169500.0 \n", " 19 2009000938159 H 2702 -9 2 1 9.0 3.0 2.0 169500.0 \n", " 20 2009001025363 H 2702 -9 2 1 2.0 2.0 2.0 182000.0 \n", " 21 2009001025363 H 2702 -9 2 1 2.0 2.0 2.0 182000.0 \n", " 22 2010001128154 H 2702 -9 2 1 4.0 3.0 2.0 170000.0 \n", " 23 2010001128154 H 2702 -9 2 1 4.0 3.0 2.0 170000.0 \n", " 24 2010001128154 H 2702 -9 2 1 4.0 3.0 2.0 170000.0 \n", " 25 2010001128154 H 2702 -9 2 1 4.0 3.0 2.0 170000.0 \n", " 26 2012000917686 H -9 8502 2 1 2.0 1.0 2.0 280000.0 \n", " 27 2012000917686 H -9 8502 2 1 2.0 1.0 2.0 280000.0 \n", " 28 2012000917686 H -9 8502 2 1 2.0 1.0 2.0 280000.0 \n", " 29 2012000917686 H -9 8502 2 1 2.0 1.0 2.0 280000.0 \n", " .. ... .. ... ... .. ... ... ... ... ... \n", " 740 2009000257552 H 2702 -9 3 1 5.0 3.0 2.0 156000.0 \n", " 741 2010000224153 H 2702 -9 2 1 9.0 3.0 2.0 69000.0 \n", " 742 2011000027489 H 2702 -9 2 1 4.0 3.0 2.0 33600.0 \n", " 743 2010000554995 H 2702 -9 3 1 8.0 3.0 2.0 64200.0 \n", " 744 2009000090585 H 2702 -9 2 1 9.0 3.0 1.0 36000.0 \n", " 745 2009000991840 H 2702 -9 2 1 2.0 2.0 3.0 113000.0 \n", " 746 2010001199295 H 2702 -9 1 1 6.0 3.0 1.0 110600.0 \n", " 747 2010000531956 H 2702 -9 2 1 1.0 1.0 2.0 74000.0 \n", " 748 2009000209747 H 2702 -9 2 1 2.0 3.0 2.0 142000.0 \n", " 749 2011000989438 H 2702 -9 1 1 2.0 1.0 1.0 237400.0 \n", " 750 2011000990235 H 2702 -9 3 1 1.0 2.0 3.0 151000.0 \n", " 751 2012000497867 H -9 8502 2 1 2.0 2.0 3.0 136200.0 \n", " 752 2013000393885 H -9 8502 1 1 2.0 3.0 5.0 69000.0 \n", " 753 2009001089483 H 2702 -9 3 1 2.0 2.0 2.0 129850.0 \n", " 754 2009000928777 H 2702 -9 2 1 2.0 2.0 3.0 188500.0 \n", " 755 2009000935893 H 2702 -9 2 1 2.0 2.0 1.0 16500.0 \n", " 756 2010000789913 H 2702 -9 2 1 9.0 3.0 2.0 60200.0 \n", " 757 2012000643381 H -9 8502 4 1 5.0 3.0 2.0 251000.0 \n", " 758 2011001475367 H 2702 -9 6 1 9.0 3.0 2.0 57000.0 \n", " 759 2012000603952 H -9 8502 8 1 2.0 3.0 3.0 99230.0 \n", " 760 2010000011387 H 2702 -9 2 1 2.0 1.0 1.0 220300.0 \n", " 761 2010001283036 H 2702 -9 2 1 2.0 1.0 2.0 51001.0 \n", " 762 2010001108709 H 2702 -9 2 1 2.0 1.0 2.0 77700.0 \n", " 763 2013001259539 H -9 8502 1 1 3.0 3.0 2.0 20000.0 \n", " 764 2011000656960 H 2702 -9 3 1 2.0 3.0 2.0 70000.0 \n", " 765 2009000208025 H 2702 -9 2 1 8.0 3.0 0.0 54100.0 \n", " 766 2011000236562 H 2702 -9 4 1 2.0 1.0 4.0 53300.0 \n", " 767 2010000805810 H 2702 -9 3 1 2.0 2.0 2.0 1000.0 \n", " 768 2010000255137 H 2702 -9 1 1 9.0 3.0 1.0 1800.0 \n", " 769 2013000496979 H -9 8502 2 1 3.0 1.0 3.0 375304.0 \n", " \n", " ... hh_size hh_workers seniors sf_detached \\\n", " 0 ... four or more two or more no no \n", " 1 ... one one no no \n", " 2 ... one one no no \n", " 3 ... one one no no \n", " 4 ... one one no no \n", " 5 ... one one no no \n", " 6 ... one none no no \n", " 7 ... one one no no \n", " 8 ... two none no no \n", " 9 ... four or more one yes no \n", " 10 ... three one no no \n", " 11 ... two none no no \n", " 12 ... two none no no \n", " 13 ... three one no no \n", " 14 ... four or more two or more no yes \n", " 15 ... three two or more no yes \n", " 16 ... two none no yes \n", " 17 ... two one no no \n", " 18 ... two one no no \n", " 19 ... two one no no \n", " 20 ... two one no yes \n", " 21 ... two one no yes \n", " 22 ... two two or more no no \n", " 23 ... two two or more no no \n", " 24 ... two two or more no no \n", " 25 ... two two or more no no \n", " 26 ... two two or more no yes \n", " 27 ... two two or more no yes \n", " 28 ... two two or more no yes \n", " 29 ... two two or more no yes \n", " .. ... ... ... ... ... \n", " 740 ... three one no no \n", " 741 ... two one no no \n", " 742 ... two one no no \n", " 743 ... three one no no \n", " 744 ... two one no no \n", " 745 ... two one no yes \n", " 746 ... one one no no \n", " 747 ... two two or more no no \n", " 748 ... two one yes yes \n", " 749 ... one one no yes \n", " 750 ... three one yes no \n", " 751 ... two none yes yes \n", " 752 ... one none yes yes \n", " 753 ... three two or more no yes \n", " 754 ... two one yes yes \n", " 755 ... two one no yes \n", " 756 ... two two or more yes no \n", " 757 ... four or more two or more no no \n", " 758 ... four or more one no no \n", " 759 ... four or more two or more no yes \n", " 760 ... two two or more no yes \n", " 761 ... two two or more yes yes \n", " 762 ... two none yes yes \n", " 763 ... one one no no \n", " 764 ... three two or more no yes \n", " 765 ... two one yes no \n", " 766 ... four or more one no yes \n", " 767 ... three none no yes \n", " 768 ... one none yes no \n", " 769 ... two two or more no no \n", " \n", " tenure_mover cat_id state county tract block group \n", " 0 rent not recent 9282 06 085 508203 3 \n", " 1 rent not recent 15490 06 085 508203 3 \n", " 2 rent not recent 17026 06 085 508203 3 \n", " 3 rent not recent 18178 06 085 508203 3 \n", " 4 rent not recent 18562 06 085 508203 3 \n", " 5 own not recent 20096 06 085 508203 3 \n", " 6 rent not recent 21602 06 085 508203 3 \n", " 7 rent not recent 21634 06 085 508203 3 \n", " 8 rent not recent 21794 06 085 508203 3 \n", " 9 rent not recent 26154 06 085 508203 3 \n", " 10 rent not recent 27874 06 085 508203 3 \n", " 11 rent not recent 29474 06 085 508203 3 \n", " 12 rent not recent 29474 06 085 508203 3 \n", " 13 rent not recent 30946 06 085 508203 3 \n", " 14 own not recent 32324 06 085 508203 3 \n", " 15 own not recent 32516 06 085 508203 3 \n", " 16 own not recent 32548 06 085 508203 3 \n", " 17 own not recent 32576 06 085 508203 3 \n", " 18 rent not recent 32578 06 085 508203 3 \n", " 19 rent not recent 32578 06 085 508203 3 \n", " 20 own not recent 32580 06 085 508203 3 \n", " 21 own not recent 32580 06 085 508203 3 \n", " 22 rent not recent 32610 06 085 508203 3 \n", " 23 rent not recent 32610 06 085 508203 3 \n", " 24 rent not recent 32610 06 085 508203 3 \n", " 25 rent not recent 32610 06 085 508203 3 \n", " 26 own not recent 32612 06 085 508203 3 \n", " 27 own not recent 32612 06 085 508203 3 \n", " 28 own not recent 32612 06 085 508203 3 \n", " 29 own not recent 32612 06 085 508203 3 \n", " .. ... ... ... ... ... ... \n", " 740 rent not recent 132322 06 085 508203 3 \n", " 741 rent not recent 36802 06 085 508203 3 \n", " 742 rent not recent 127426 06 085 508203 3 \n", " 743 rent not recent 43618 06 085 508203 3 \n", " 744 rent recent 110915 06 085 508203 3 \n", " 745 own not recent 31044 06 085 508203 3 \n", " 746 rent not recent 108802 06 085 508203 3 \n", " 747 own not recent 36832 06 085 508203 3 \n", " 748 rent not recent 78286 06 085 508203 3 \n", " 749 own not recent 18180 06 085 508203 3 \n", " 750 own not recent 79736 06 085 508203 3 \n", " 751 own not recent 78252 06 085 508203 3 \n", " 752 rent not recent 82670 06 085 508203 3 \n", " 753 own not recent 38660 06 085 508203 3 \n", " 754 own not recent 79820 06 085 508203 3 \n", " 755 own not recent 21828 06 085 508203 3 \n", " 756 rent not recent 82154 06 085 508203 3 \n", " 757 rent recent 132163 06 085 508203 3 \n", " 758 rent not recent 42674 06 085 508203 3 \n", " 759 rent not recent 44230 06 085 508203 3 \n", " 760 own not recent 18404 06 085 508203 3 \n", " 761 own not recent 81388 06 085 508203 3 \n", " 762 own not recent 36780 06 085 508203 3 \n", " 763 rent not recent 38146 06 085 508203 3 \n", " 764 rent not recent 136598 06 085 508203 3 \n", " 765 rent not recent 49482 06 085 508203 3 \n", " 766 own not recent 33828 06 085 508203 3 \n", " 767 own not recent 37060 06 085 508203 3 \n", " 768 rent not recent 68858 06 085 508203 3 \n", " 769 own not recent 124768 06 085 508203 3 \n", " \n", " [770 rows x 32 columns],\n", " serialno puma00 puma10 AGEP RELP SEX ESR HISP RAC1P hispanic \\\n", " 0 2012000024049 -9 8502 47 1 2 6.0 1 6 no \n", " 1 2012000024049 -9 8502 47 1 2 6.0 1 6 no \n", " 2 2012000024049 -9 8502 47 1 2 6.0 1 6 no \n", " 3 2012000024049 -9 8502 53 0 1 1.0 1 6 no \n", " 4 2012000024049 -9 8502 53 0 1 1.0 1 6 no \n", " 5 2012000024049 -9 8502 53 0 1 1.0 1 6 no \n", " 6 2012000024049 -9 8502 17 2 1 6.0 1 6 no \n", " 7 2012000024049 -9 8502 17 2 1 6.0 1 6 no \n", " 8 2012000024049 -9 8502 17 2 1 6.0 1 6 no \n", " 9 2012000024049 -9 8502 6 2 2 NaN 1 6 no \n", " 10 2012000024049 -9 8502 6 2 2 NaN 1 6 no \n", " 11 2012000024049 -9 8502 6 2 2 NaN 1 6 no \n", " 12 2012000038026 -9 8502 37 1 2 3.0 1 6 no \n", " 13 2012000038026 -9 8502 48 0 1 1.0 1 6 no \n", " 14 2012000038026 -9 8502 6 2 1 NaN 1 6 no \n", " 15 2012000038026 -9 8502 4 2 2 NaN 1 6 no \n", " 16 2012000076386 -9 8502 43 0 2 6.0 1 6 no \n", " 17 2012000076386 -9 8502 43 0 2 6.0 1 6 no \n", " 18 2012000076386 -9 8502 43 0 2 6.0 1 6 no \n", " 19 2012000076386 -9 8502 46 1 1 1.0 1 6 no \n", " 20 2012000076386 -9 8502 46 1 1 1.0 1 6 no \n", " 21 2012000076386 -9 8502 46 1 1 1.0 1 6 no \n", " 22 2012000076386 -9 8502 12 2 1 NaN 1 6 no \n", " 23 2012000076386 -9 8502 12 2 1 NaN 1 6 no \n", " 24 2012000076386 -9 8502 12 2 1 NaN 1 6 no \n", " 25 2012000076386 -9 8502 16 2 2 6.0 1 6 no \n", " 26 2012000076386 -9 8502 16 2 2 6.0 1 6 no \n", " 27 2012000076386 -9 8502 16 2 2 6.0 1 6 no \n", " 28 2012000176039 -9 8502 58 1 2 1.0 1 6 no \n", " 29 2012000176039 -9 8502 27 2 1 1.0 1 6 no \n", " ... ... ... ... ... ... ... ... ... ... ... \n", " 2244 2009001006831 2702 -9 34 0 1 1.0 2 1 yes \n", " 2245 2009001006831 2702 -9 4 2 1 NaN 2 1 yes \n", " 2246 2009001006831 2702 -9 4 2 1 NaN 2 1 yes \n", " 2247 2009001006831 2702 -9 2 2 2 NaN 2 1 yes \n", " 2248 2009001006831 2702 -9 2 2 2 NaN 2 1 yes \n", " 2249 2011000656960 2702 -9 26 1 2 1.0 2 1 yes \n", " 2250 2011000656960 2702 -9 26 1 2 1.0 2 1 yes \n", " 2251 2011000656960 2702 -9 27 0 1 1.0 2 1 yes \n", " 2252 2011000656960 2702 -9 27 0 1 1.0 2 1 yes \n", " 2253 2011000656960 2702 -9 1 2 1 NaN 2 1 yes \n", " 2254 2011000656960 2702 -9 1 2 1 NaN 2 1 yes \n", " 2255 2013000583586 -9 8502 34 0 1 1.0 2 1 yes \n", " 2256 2011000482661 2702 -9 34 2 1 1.0 2 1 yes \n", " 2257 2011000482661 2702 -9 67 0 1 6.0 2 1 yes \n", " 2258 2011000482661 2702 -9 8 7 2 NaN 2 1 yes \n", " 2259 2011000482661 2702 -9 73 1 2 6.0 2 1 yes \n", " 2260 2010000789913 2702 -9 60 1 2 1.0 1 2 no \n", " 2261 2010000789913 2702 -9 68 0 1 1.0 1 2 no \n", " 2262 2012000306986 -9 8502 83 0 1 6.0 1 6 no \n", " 2263 2013001102796 -9 8502 74 0 1 6.0 1 6 no \n", " 2264 2009000183391 2702 -9 63 0 1 1.0 1 6 no \n", " 2265 2012001080872 -9 8502 93 0 1 6.0 2 1 yes \n", " 2266 2012001080872 -9 8502 80 1 2 6.0 2 1 yes \n", " 2267 2012001247807 -9 8502 88 0 1 6.0 3 1 yes \n", " 2268 2012001247807 -9 8502 93 1 2 6.0 3 1 yes \n", " 2269 2013000619824 -9 8502 77 1 1 6.0 2 1 yes \n", " 2270 2013000619824 -9 8502 77 0 2 6.0 2 1 yes \n", " 2271 2010000396495 2702 -9 61 0 1 1.0 20 1 yes \n", " 2272 2010000396495 2702 -9 61 1 2 1.0 20 1 yes \n", " 2273 2010000255137 2702 -9 84 0 2 6.0 3 1 yes \n", " \n", " person_age person_sex race cat_id hh_id \n", " 0 35 to 60 female asian 138256 98 \n", " 1 35 to 60 female asian 138256 106 \n", " 2 35 to 60 female asian 138256 107 \n", " 3 35 to 60 male asian 138260 98 \n", " 4 35 to 60 male asian 138260 106 \n", " 5 35 to 60 male asian 138260 107 \n", " 6 19 and under male asian 138244 98 \n", " 7 19 and under male asian 138244 106 \n", " 8 19 and under male asian 138244 107 \n", " 9 19 and under female asian 138240 98 \n", " 10 19 and under female asian 138240 106 \n", " 11 19 and under female asian 138240 107 \n", " 12 35 to 60 female asian 138256 54 \n", " 13 35 to 60 male asian 138260 54 \n", " 14 19 and under male asian 138244 54 \n", " 15 19 and under female asian 138240 54 \n", " 16 35 to 60 female asian 138256 75 \n", " 17 35 to 60 female asian 138256 80 \n", " 18 35 to 60 female asian 138256 84 \n", " 19 35 to 60 male asian 138260 75 \n", " 20 35 to 60 male asian 138260 80 \n", " 21 35 to 60 male asian 138260 84 \n", " 22 19 and under male asian 138244 75 \n", " 23 19 and under male asian 138244 80 \n", " 24 19 and under male asian 138244 84 \n", " 25 19 and under female asian 138240 75 \n", " 26 19 and under female asian 138240 80 \n", " 27 19 and under female asian 138240 84 \n", " 28 35 to 60 female asian 138256 631 \n", " 29 20 to 35 male asian 138252 631 \n", " ... ... ... ... ... ... \n", " 2244 20 to 35 male white 138287 607 \n", " 2245 19 and under male white 138279 356 \n", " 2246 19 and under male white 138279 607 \n", " 2247 19 and under female white 138275 356 \n", " 2248 19 and under female white 138275 607 \n", " 2249 20 to 35 female white 138283 447 \n", " 2250 20 to 35 female white 138283 764 \n", " 2251 20 to 35 male white 138287 447 \n", " 2252 20 to 35 male white 138287 764 \n", " 2253 19 and under male white 138279 447 \n", " 2254 19 and under male white 138279 764 \n", " 2255 20 to 35 male white 138287 564 \n", " 2256 20 to 35 male white 138287 718 \n", " 2257 above 60 male white 138303 718 \n", " 2258 19 and under female white 138275 718 \n", " 2259 above 60 female white 138299 718 \n", " 2260 35 to 60 female black 138257 756 \n", " 2261 above 60 male black 138269 756 \n", " 2262 above 60 male asian 138268 571 \n", " 2263 above 60 male asian 138268 452 \n", " 2264 above 60 male asian 138268 701 \n", " 2265 above 60 male white 138303 563 \n", " 2266 above 60 female white 138299 563 \n", " 2267 above 60 male white 138303 574 \n", " 2268 above 60 female white 138299 574 \n", " 2269 above 60 male white 138303 533 \n", " 2270 above 60 female white 138299 533 \n", " 2271 above 60 male white 138303 713 \n", " 2272 above 60 female white 138299 713 \n", " 2273 above 60 female white 138299 768 \n", " \n", " [2274 rows x 15 columns],\n", " {BlockGroupID(state='06', county='085', tract='508203', block_group='3'): FitQuality(people_chisq=50.53639934882075, people_p=0.37362753869683724)})" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ind = pd.Series([\"06\", \"085\", \"508203\", \"3\"], index=[\"state\", \"county\", \"tract\", \"block group\"])\n", "synthesize_all(starter, indexes=[ind])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.6.4" } }, "nbformat": 4, "nbformat_minor": 1 }