{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "\n", "import synthpop.zone_synthesizer as zs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Specify sample data csv paths. See the files listed here for expected structure. Marginal tables require multi-indexed columns with category name and category value in levels 0 and 1 of the index. Sample file category columns should be labeled with corresponding category names and values in those columns should match the category value headers in the marginal table." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "hh_marginal_file = 'input_data/hh_marginals.csv'\n", "person_marginal_file = 'input_data/person_marginals.csv'\n", "hh_sample_file = 'input_data/household_sample.csv'\n", "person_sample_file = 'input_data/person_sample.csv'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Load and process input marginals and samples and geography crosswalk" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "hh_marg, p_marg, hh_sample, p_sample, xwalk = zs.load_data(hh_marginal_file, person_marginal_file, hh_sample_file, person_sample_file)" ] }, { "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
cat_namecarschildrenincomeworkers
cat_valuesnoneonetwo or morenoyesgt100gt35-lt100lt35noneonetwo or more
17491974121557125747277105
29592376823983126988793125
310692757927974170114102108146
4117630216722442105244111118160
5181174668651750261292171182247
\n", "
" ], "text/plain": [ "cat_name cars children income workers \\\n", "cat_values none one two or more no yes gt100 gt35-lt100 lt35 none \n", "1 7 49 197 41 215 57 125 74 72 \n", "2 9 59 237 68 239 83 126 98 87 \n", "3 10 69 275 79 279 74 170 114 102 \n", "4 11 76 302 167 224 42 105 244 111 \n", "5 18 117 466 86 517 50 261 292 171 \n", "\n", "cat_name \n", "cat_values one two or more \n", "1 77 105 \n", "2 93 125 \n", "3 108 146 \n", "4 118 160 \n", "5 182 247 " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "hh_marg.head()" ] }, { "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
cat_nameageracesex
cat_values19 and under20 to 3535 to 60above 60asianblackotherwhitefemalemale
13121082231776400756440380
2235143296181000855452403
330322944517400241127565586
4215773561890029808389448
55065396192620001926981945
\n", "
" ], "text/plain": [ "cat_name age race \\\n", "cat_values 19 and under 20 to 35 35 to 60 above 60 asian black other white \n", "1 312 108 223 177 64 0 0 756 \n", "2 235 143 296 181 0 0 0 855 \n", "3 303 229 445 174 0 0 24 1127 \n", "4 215 77 356 189 0 0 29 808 \n", "5 506 539 619 262 0 0 0 1926 \n", "\n", "cat_name sex \n", "cat_values female male \n", "1 440 380 \n", "2 452 403 \n", "3 565 586 \n", "4 389 448 \n", "5 981 945 " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p_marg.head()" ] }, { "cell_type": "code", "execution_count": 8, "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", "
serialnosample_geogageracesexAGEPSEXRAC1P
02012000005576120 to 35whitemale2711
12012000017760120 to 35whitemale3411
22012000021787120 to 35whitemale3211
32012000021815120 to 35whitemale2311
42012000065237120 to 35whitemale2411
\n", "
" ], "text/plain": [ " serialno sample_geog age race sex AGEP SEX RAC1P\n", "0 2012000005576 1 20 to 35 white male 27 1 1\n", "1 2012000017760 1 20 to 35 white male 34 1 1\n", "2 2012000021787 1 20 to 35 white male 32 1 1\n", "3 2012000021815 1 20 to 35 white male 23 1 1\n", "4 2012000065237 1 20 to 35 white male 24 1 1" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p_sample.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Iterate over all marginals in the geography crosswalk and synthesize in-line" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "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 254 households\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 306 households\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 356 households\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 390 households\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 601 households\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 324 households\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 556 households\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 342 households\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 273 households\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 228 households\n", "Drawing 857 households\n", "Drawing 748 households\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 744 households\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 953 households\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 719 households\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 185 households\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 183 households\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 286 households\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 317 households\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 711 households\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 345 households\n" ] } ], "source": [ "all_households, all_persons, all_stats = zs.synthesize_all_zones(hh_marg, p_marg, hh_sample, p_sample, xwalk)" ] }, { "cell_type": "code", "execution_count": 10, "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", "
serialnosample_geogcarsworkerschildrenincomeVEHFINCPNOCWIFcat_idgeog
household_id
120100012292651nonenonenolt350NaN0NaN61
220100002629471nonenoneyeslt3500.010.0151
320100001413681nonenoneyeslt3503500.010.0151
420120001625411nonenoneyeslt35018300.020.0151
520120014761101nonenoneyeslt3503100.030.0151
\n", "
" ], "text/plain": [ " serialno sample_geog cars workers children income VEH \\\n", "household_id \n", "1 2010001229265 1 none none no lt35 0 \n", "2 2010000262947 1 none none yes lt35 0 \n", "3 2010000141368 1 none none yes lt35 0 \n", "4 2012000162541 1 none none yes lt35 0 \n", "5 2012001476110 1 none none yes lt35 0 \n", "\n", " FINCP NOC WIF cat_id geog \n", "household_id \n", "1 NaN 0 NaN 6 1 \n", "2 0.0 1 0.0 15 1 \n", "3 3500.0 1 0.0 15 1 \n", "4 18300.0 2 0.0 15 1 \n", "5 3100.0 3 0.0 15 1 " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "all_households.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### all_persons.household_id maps person records to all_households.index" ] }, { "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
serialnosample_geogageracesexAGEPSEXRAC1Pcat_idgeoghousehold_id
02012000136005120 to 35whitemale311169185
12012000136005135 to 60whitefemale362176185
22012000136005119 and underwhitemale101161185
32012000136005119 and underwhitemale81161185
42012000136005119 and underwhitemale51161185
\n", "
" ], "text/plain": [ " serialno sample_geog age race sex AGEP SEX RAC1P \\\n", "0 2012000136005 1 20 to 35 white male 31 1 1 \n", "1 2012000136005 1 35 to 60 white female 36 2 1 \n", "2 2012000136005 1 19 and under white male 10 1 1 \n", "3 2012000136005 1 19 and under white male 8 1 1 \n", "4 2012000136005 1 19 and under white male 5 1 1 \n", "\n", " cat_id geog household_id \n", "0 69 1 85 \n", "1 76 1 85 \n", "2 61 1 85 \n", "3 61 1 85 \n", "4 61 1 85 " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "all_persons.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Synthesize all marginal geographies in the crosswalk using a specified or default number of cores via multiprocessing" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "all_persons, all_households, all_stats = zs.multiprocess_synthesize(hh_marg, p_marg, hh_sample, p_sample, xwalk)" ] }, { "cell_type": "code", "execution_count": 13, "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", "
serialnosample_geogageracesexAGEPSEXRAC1Pcat_idgeoghousehold_id
02012000136005120 to 35whitemale311169181
12012000136005135 to 60whitefemale362176181
22012000136005119 and underwhitemale101161181
32012000136005119 and underwhitemale81161181
42012000136005119 and underwhitemale51161181
\n", "
" ], "text/plain": [ " serialno sample_geog age race sex AGEP SEX RAC1P \\\n", "0 2012000136005 1 20 to 35 white male 31 1 1 \n", "1 2012000136005 1 35 to 60 white female 36 2 1 \n", "2 2012000136005 1 19 and under white male 10 1 1 \n", "3 2012000136005 1 19 and under white male 8 1 1 \n", "4 2012000136005 1 19 and under white male 5 1 1 \n", "\n", " cat_id geog household_id \n", "0 69 1 81 \n", "1 76 1 81 \n", "2 61 1 81 \n", "3 61 1 81 \n", "4 61 1 81 " ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "all_persons.head()" ] }, { "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
serialnosample_geogcarsworkerschildrenincomeVEHFINCPNOCWIFcat_idgeog
household_id
120090004653301nonenonenolt350NaN0NaN61
220090004559721nonenoneyeslt3503500.020.0151
320120014761101nonenoneyeslt3503100.030.0151
420120014761101nonenoneyeslt3503100.030.0151
520100001413681nonenoneyeslt3503500.010.0151
\n", "
" ], "text/plain": [ " serialno sample_geog cars workers children income VEH \\\n", "household_id \n", "1 2009000465330 1 none none no lt35 0 \n", "2 2009000455972 1 none none yes lt35 0 \n", "3 2012001476110 1 none none yes lt35 0 \n", "4 2012001476110 1 none none yes lt35 0 \n", "5 2010000141368 1 none none yes lt35 0 \n", "\n", " FINCP NOC WIF cat_id geog \n", "household_id \n", "1 NaN 0 NaN 6 1 \n", "2 3500.0 2 0.0 15 1 \n", "3 3100.0 3 0.0 15 1 \n", "4 3100.0 3 0.0 15 1 \n", "5 3500.0 1 0.0 15 1 " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "all_households.head()" ] }, { "cell_type": "code", "execution_count": 15, "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", "
chi-squaregeogp-score
02.07085519.998970e-01
1154.42091324.782383e-30
2182.58567035.033580e-32
396.43644642.276937e-14
4468.71425054.243758e-97
55.64296869.581878e-01
6516.86687572.458698e-101
779.63830581.632443e-14
8117.23866391.836683e-20
92000.143804100.000000e+00
10642.117025112.372825e-117
1162.442878124.130503e-07
121174.759712138.130438e-234
13670.414502142.542384e-132
141081.225334154.449635e-220
1512.940226167.357824e-02
161.161109179.917950e-01
17159.879713182.084872e-27
180.507767199.994175e-01
19116.945628207.393055e-18
2014.386659214.471640e-02
\n", "
" ], "text/plain": [ " chi-square geog p-score\n", "0 2.070855 1 9.998970e-01\n", "1 154.420913 2 4.782383e-30\n", "2 182.585670 3 5.033580e-32\n", "3 96.436446 4 2.276937e-14\n", "4 468.714250 5 4.243758e-97\n", "5 5.642968 6 9.581878e-01\n", "6 516.866875 7 2.458698e-101\n", "7 79.638305 8 1.632443e-14\n", "8 117.238663 9 1.836683e-20\n", "9 2000.143804 10 0.000000e+00\n", "10 642.117025 11 2.372825e-117\n", "11 62.442878 12 4.130503e-07\n", "12 1174.759712 13 8.130438e-234\n", "13 670.414502 14 2.542384e-132\n", "14 1081.225334 15 4.449635e-220\n", "15 12.940226 16 7.357824e-02\n", "16 1.161109 17 9.917950e-01\n", "17 159.879713 18 2.084872e-27\n", "18 0.507767 19 9.994175e-01\n", "19 116.945628 20 7.393055e-18\n", "20 14.386659 21 4.471640e-02" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "all_stats" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "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 }