From a916134df3d0718754b0a85d509cec75b0d736a0 Mon Sep 17 00:00:00 2001 From: Fletcher Foti Date: Thu, 18 Dec 2014 14:42:53 -0800 Subject: [PATCH 1/2] adding the size terms to workplace location choice --- activitysim/activitysim.py | 1 + example/configs/workplace_location.csv | 2 +- .../configs/workplace_location_size_terms.csv | 1 + example/models.py | 59 +++++++- notebooks/data_mover.ipynb | 24 ++-- notebooks/simulation.ipynb | 135 +++++++++++++++--- 6 files changed, 186 insertions(+), 36 deletions(-) create mode 100644 example/configs/workplace_location_size_terms.csv diff --git a/activitysim/activitysim.py b/activitysim/activitysim.py index b365f7631..b8655e363 100644 --- a/activitysim/activitysim.py +++ b/activitysim/activitysim.py @@ -105,6 +105,7 @@ def simple_simulate(choosers, alternatives, spec, print "Failed with DataFrame eval:\n%s" % expr raise e vars[expr] = s + vars[expr] = vars[expr].astype('float') # explicit cast model_design = pd.DataFrame(vars, index=df.index) df = random_rows(model_design, min(100000, len(model_design)))\ diff --git a/example/configs/workplace_location.csv b/example/configs/workplace_location.csv index 81e4f4de0..af7b3ce91 100644 --- a/example/configs/workplace_location.csv +++ b/example/configs/workplace_location.csv @@ -1 +1 @@ -Description,Expression,Alt "Distance, piecewise linear from 0 to 1 miles",@df.distance.clip(1),-0.8428 "Distance, piecewise linear from 1 to 2 miles","@(df.distance-1).clip(0,1)",-0.3104 "Distance, piecewise linear from 2 to 5 miles","@(df.distance-2).clip(0,3)",-0.3783 "Distance, piecewise linear from 5 to 15 miles","@(df.distance-5).clip(0,10)",-0.1285 "Distance, piecewise linear for 15+ miles",@(df.distance-15.0).clip(0),-0.0917 "Distance 0 to 5 mi, high and very high income",@(df.income_segment>=3)*df.distance.clip(upper=5),0.15 "Distance 5+ mi, high and very high income",@(df.income_segment>=3)*(df.distance-5).clip(0),0.02 "Size variable full-time worker, low income",(income_segment==1)*lnWorkLowDcSizeAlt,1 "Size variable full-time worker, medium income",(income_segment==2)*lnWorkMedDcSizeAlt,1 "Size variable full-time worker, high income",(income_segment==3)*lnWorkHighDcSizeAlt,1 "Size variable full-time worker, very high income",(income_segment==4)*lnWorkVeryHighDcSizeAlt,1 "No attractions full-time worker, low income",(income_segment==1)*lnWorkLowDcSizeAlt==0,-999 "No attractions full-time worker, medium income",(income_segment==2)*lnWorkMedDcSizeAlt==0,-999 "No attractions full-time worker, high income",(income_segment==3)*lnWorkHighDcSizeAlt==0,-999 "No attractions full-time worker, very high income",(income_segment==4)*lnWorkVeryHighDcSizeAlt==0,-999 Mode choice logsum,mcLogsum,0.3 \ No newline at end of file +Description,Expression,Alt "Distance, piecewise linear from 0 to 1 miles",@df.distance.clip(1),-0.8428 "Distance, piecewise linear from 1 to 2 miles","@(df.distance-1).clip(0,1)",-0.3104 "Distance, piecewise linear from 2 to 5 miles","@(df.distance-2).clip(0,3)",-0.3783 "Distance, piecewise linear from 5 to 15 miles","@(df.distance-5).clip(0,10)",-0.1285 "Distance, piecewise linear for 15+ miles",@(df.distance-15.0).clip(0),-0.0917 "Distance 0 to 5 mi, high and very high income",@(df.income_segment>=3)*df.distance.clip(upper=5),0.15 "Distance 5+ mi, high and very high income",@(df.income_segment>=3)*(df.distance-5).clip(0),0.02 "Size variable full-time worker, low income",@(df.income_segment==1)*df.size_low,1 "Size variable full-time worker, medium income",@(df.income_segment==2)*df.size_med,1 "Size variable full-time worker, high income",@(df.income_segment==3)*df.size_high,1 "Size variable full-time worker, very high income",@(df.income_segment==4)*df.size_veryhigh,1 "No attractions full-time worker, low income",@(df.income_segment==1)&(df.size_low==0),-999 "No attractions full-time worker, medium income",@(df.income_segment==2)&(df.size_med==0),-999 "No attractions full-time worker, high income",@(df.income_segment==3)&(df.size_high==0),-999 "No attractions full-time worker, very high income",@(df.income_segment==4)&(df.size_veryhigh==0),-999 Mode choice logsum,mcLogsum,0.3 \ No newline at end of file diff --git a/example/configs/workplace_location_size_terms.csv b/example/configs/workplace_location_size_terms.csv new file mode 100644 index 000000000..f9b7da433 --- /dev/null +++ b/example/configs/workplace_location_size_terms.csv @@ -0,0 +1 @@ +purpose,segment,TOTHH,RETEMPN,FPSEMPN,HEREMPN,OTHEMPN,AGREMPN,MWTEMPN,AGE0519,HSENROLL,COLLFTE,COLLPTE work,low,0,0.129,0.193,0.383,0.12,0.01,0.164,0,0,0,0 work,med,0,0.12,0.197,0.325,0.139,0.008,0.21,0,0,0,0 work,high,0,0.11,0.207,0.284,0.154,0.006,0.239,0,0,0,0 work,veryhigh,0,0.093,0.27,0.241,0.146,0.004,0.246,0,0,0,0 university,university,0,0,0,0,0,0,0,0,0,0.592,0.408 school,grade,0,0,0,0,0,0,0,1,0,0,0 school,high,0,0,0,0,0,0,0,0,1,0,0 escort,kids,0,0.225,0,0.144,0,0,0,0.465,0.166,0,0 escort,no kids,0,0.225,0,0.144,0,0,0,0.465,0.166,0,0 shopping,shopping,0,1,0,0,0,0,0,0,0,0,0 eatOut,eatOut,0,0.742,0,0.258,0,0,0,0,0,0,0 othMaint,othMaint,0,0.482,0,0.518,0,0,0,0,0,0,0 social,social,0,0.522,0,0.478,0,0,0,0,0,0,0 othDiscr,othDiscr,0.252,0.212,0,0.272,0.165,0,0,0,0.098,0,0 atwork,atwork,0,0.742,0,0.258,0,0,0,0,0,0,0 \ No newline at end of file diff --git a/example/models.py b/example/models.py index 4e1a2de07..8e2e13138 100644 --- a/example/models.py +++ b/example/models.py @@ -37,7 +37,37 @@ def auto_ownership_spec(): @sim.injectable() def workplace_location_spec(): f = os.path.join('configs', "workplace_location.csv") - return asim.read_model_spec(f).head(7) + return asim.read_model_spec(f).head(15) + + +@sim.table() +def workplace_size_spec(): + f = os.path.join('configs', 'workplace_location_size_terms.csv') + return pd.read_csv(f) + + +@sim.table() +def workplace_size_terms(land_use, workplace_size_spec): + """ + This method takes the land use data and multiplies various columns of the + land use data by coefficients from the workplace_size_spec table in order + to yield a size term (a linear combination of land use variables) with + specified coefficients for different segments (like low, med, and high + income) + """ + land_use = land_use.to_frame() + df = workplace_size_spec.to_frame().query("purpose == 'work'") + df = df.drop("purpose", axis=1).set_index("segment") + new_df = {} + for index, row in df.iterrows(): + missing = row[~row.index.isin(land_use.columns)] + if len(missing) > 0: + print "WARNING: missing columns in land use\n", missing.index + row = row[row.index.isin(land_use.columns)] + sparse = land_use[list(row.index)] + new_df["size_"+index] = np.dot(sparse.as_matrix(), row.values) + new_df = pd.DataFrame(new_df, index=land_use.index) + return new_df @sim.model() @@ -67,10 +97,11 @@ def workplace_location_simulate(persons, households, zones, workplace_location_spec, - distance_matrix): + distance_matrix, + workplace_size_terms): choosers = sim.merge_tables(persons.name, tables=[persons, households]) - alternatives = zones.to_frame() + alternatives = zones.to_frame().join(workplace_size_terms.to_frame()) skims = { "distance": distance_matrix @@ -88,4 +119,24 @@ def workplace_location_simulate(persons, print "Describe of hoices:\n", choices.describe() sim.add_column("persons", "workplace_taz", choices) - return model_design \ No newline at end of file + return model_design + + +@sim.column("land_use") +def total_households(land_use): + return land_use.local.TOTHH + + +@sim.column("land_use") +def total_employment(land_use): + return land_use.local.TOTEMP + + +@sim.column("land_use") +def total_acres(land_use): + return land_use.local.TOTACRE + + +@sim.column("land_use") +def county_id(land_use): + return land_use.local.COUNTY \ No newline at end of file diff --git a/notebooks/data_mover.ipynb b/notebooks/data_mover.ipynb index de39900c4..a2b60842a 100644 --- a/notebooks/data_mover.ipynb +++ b/notebooks/data_mover.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:d62442075d195d4893cdd65305dac0932aeb18464bb30a1d8aac6a89ad987ef1" + "signature": "sha256:42ad8a2d396c95f5a0908ef4573c367e796539873eb37e25368303c840ce8144" }, "nbformat": 3, "nbformat_minor": 0, @@ -23,7 +23,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 1 + "prompt_number": 8 }, { "cell_type": "code", @@ -34,7 +34,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 2 + "prompt_number": 9 }, { "cell_type": "code", @@ -43,10 +43,6 @@ "col_map = {\n", " \"HHID\": \"household_id\",\n", " \"AGE\": \"age\",\n", - " \"TOTHH\": \"total_households\",\n", - " \"TOTEMP\": \"total_employment\",\n", - " \"TOTACRE\": \"total_acres\",\n", - " \"COUNTY\": \"county_id\",\n", " \"hworkers\": \"workers\",\n", " \"HINC\": \"income\"\n", "}" @@ -54,7 +50,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 3 + "prompt_number": 10 }, { "cell_type": "code", @@ -67,7 +63,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 4 + "prompt_number": 11 }, { "cell_type": "code", @@ -80,7 +76,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 5 + "prompt_number": 12 }, { "cell_type": "code", @@ -93,7 +89,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 6 + "prompt_number": 13 }, { "cell_type": "code", @@ -106,7 +102,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 7 + "prompt_number": 14 }, { "cell_type": "code", @@ -117,7 +113,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 8 + "prompt_number": 15 }, { "cell_type": "code", @@ -126,7 +122,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 8 + "prompt_number": 15 } ], "metadata": {} diff --git a/notebooks/simulation.ipynb b/notebooks/simulation.ipynb index 32d001321..3706d1c5d 100644 --- a/notebooks/simulation.ipynb +++ b/notebooks/simulation.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:cb73756f0a7f3470c0c4541684733fd8652356e192071a11aa9a63ea4d09939d" + "signature": "sha256:91f542460b3cae577fb9ec30253001b42cf49778967f6010a66dc1300a924eee" }, "nbformat": 3, "nbformat_minor": 0, @@ -26,6 +26,107 @@ "outputs": [], "prompt_number": 1 }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "sim.get_table(\"workplace_size_terms\").to_frame().describe()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "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", + "
size_highsize_lowsize_medsize_veryhigh
count 1454.000000 1454.000000 1454.000000 1454.000000
mean 470.262747 479.758949 472.730994 473.212087
std 718.857048 680.407989 698.189639 751.556504
min 0.000000 0.000000 0.000000 0.000000
25% 105.804000 118.629000 110.735250 104.206250
50% 214.630500 236.246500 223.247500 210.595000
75% 490.684000 529.061750 505.979000 476.282250
max 6973.074000 6514.059000 6722.658000 7604.876000
\n", + "
" + ], + "metadata": {}, + "output_type": "pyout", + "prompt_number": 2, + "text": [ + " size_high size_low size_med size_veryhigh\n", + "count 1454.000000 1454.000000 1454.000000 1454.000000\n", + "mean 470.262747 479.758949 472.730994 473.212087\n", + "std 718.857048 680.407989 698.189639 751.556504\n", + "min 0.000000 0.000000 0.000000 0.000000\n", + "25% 105.804000 118.629000 110.735250 104.206250\n", + "50% 214.630500 236.246500 223.247500 210.595000\n", + "75% 490.684000 529.061750 505.979000 476.282250\n", + "max 6973.074000 6514.059000 6722.658000 7604.876000" + ] + } + ], + "prompt_number": 2 + }, { "cell_type": "code", "collapsed": false, @@ -47,16 +148,16 @@ "output_type": "stream", "stream": "stdout", "text": [ - "count 257504.000000\n", - "mean 734.636817\n", - "std 417.985400\n", + "count 257922.000000\n", + "mean 719.446720\n", + "std 423.429354\n", "min 1.000000\n", - "25% 391.000000\n", - "50% 745.000000\n", - "75% 1106.000000\n", + "25% 352.000000\n", + "50% 720.000000\n", + "75% 1084.000000\n", "max 1454.000000\n", "Name: TAZ, dtype: float64\n", - "Time to execute model 'workplace_location_simulate': 17.01s" + "Time to execute model 'workplace_location_simulate': 36.80s" ] }, { @@ -64,7 +165,7 @@ "stream": "stdout", "text": [ "\n", - "Total time to execute: 17.01s\n" + "Total time to execute: 36.80s\n" ] } ], @@ -91,13 +192,13 @@ "output_type": "stream", "stream": "stdout", "text": [ - "cars2 48107\n", - "cars3 38246\n", - "cars1 7364\n", - "cars4 5087\n", - "cars0 1196\n", + "cars2 47812\n", + "cars3 38243\n", + "cars1 7580\n", + "cars4 5178\n", + "cars0 1187\n", "dtype: int64\n", - "Time to execute model 'auto_ownership_simulate': 5.08s" + "Time to execute model 'auto_ownership_simulate': 8.78s" ] }, { @@ -105,11 +206,11 @@ "stream": "stdout", "text": [ "\n", - "Total time to execute: 5.08s\n" + "Total time to execute: 8.78s\n" ] } ], - "prompt_number": 5 + "prompt_number": 3 }, { "cell_type": "code", From 24f770e255a2cec87c790286029c7483e2c75746 Mon Sep 17 00:00:00 2001 From: Fletcher Foti Date: Thu, 19 Feb 2015 16:54:03 -0800 Subject: [PATCH 2/2] with the changes from the other branch, this branch ran with no edits --- notebooks/data_mover.ipynb | 20 +- notebooks/simulation.ipynb | 730 +++++++++++++++++++++++++++++++++++++ 2 files changed, 740 insertions(+), 10 deletions(-) create mode 100644 notebooks/simulation.ipynb diff --git a/notebooks/data_mover.ipynb b/notebooks/data_mover.ipynb index a2b60842a..1c065abf1 100644 --- a/notebooks/data_mover.ipynb +++ b/notebooks/data_mover.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:42ad8a2d396c95f5a0908ef4573c367e796539873eb37e25368303c840ce8144" + "signature": "sha256:afbc3e7040dd9e4a5b21433063f13a6a8abfcc04bcfc6574e7e43376c257cd33" }, "nbformat": 3, "nbformat_minor": 0, @@ -23,7 +23,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 8 + "prompt_number": 1 }, { "cell_type": "code", @@ -34,7 +34,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 9 + "prompt_number": 2 }, { "cell_type": "code", @@ -50,7 +50,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 10 + "prompt_number": 3 }, { "cell_type": "code", @@ -63,7 +63,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 11 + "prompt_number": 4 }, { "cell_type": "code", @@ -76,7 +76,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 12 + "prompt_number": 5 }, { "cell_type": "code", @@ -89,7 +89,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 13 + "prompt_number": 6 }, { "cell_type": "code", @@ -102,7 +102,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 14 + "prompt_number": 7 }, { "cell_type": "code", @@ -113,7 +113,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 15 + "prompt_number": 8 }, { "cell_type": "code", @@ -122,7 +122,7 @@ "language": "python", "metadata": {}, "outputs": [], - "prompt_number": 15 + "prompt_number": 8 } ], "metadata": {} diff --git a/notebooks/simulation.ipynb b/notebooks/simulation.ipynb new file mode 100644 index 000000000..1643e621d --- /dev/null +++ b/notebooks/simulation.ipynb @@ -0,0 +1,730 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:68dd59fb87c331bcb79d97a97557ee2ee411309bd3a85e58d6bee4b169b221df" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%load_ext autoreload\n", + "%autoreload 2\n", + "if 'sim' not in globals():\n", + " import os; os.chdir('../example')\n", + "import urbansim.sim.simulation as sim\n", + "from activitysim.defaults import variables\n", + "import models" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "sim.run([\"workplace_location_simulate\"])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Running model 'workplace_location_simulate'\n", + "Describe of hoices:\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "count 258078.000000\n", + "mean 718.510997\n", + "std 422.975764\n", + "min 1.000000\n", + "25% 352.000000\n", + "50% 719.000000\n", + "75% 1083.000000\n", + "max 1454.000000\n", + "Name: TAZ, dtype: float64\n", + "Time to execute model 'workplace_location_simulate': 35.33s" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Total time to execute: 35.34s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "sim.run([\"auto_ownership_simulate\"])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Running model 'auto_ownership_simulate'\n", + "Choices:\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cars2 47959\n", + "cars3 38186\n", + "cars1 7528\n", + "cars4 5123\n", + "cars0 1204\n", + "dtype: int64\n", + "Time to execute model 'auto_ownership_simulate': 4.62s" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Total time to execute: 4.62s\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "sim.get_table(\"land_use\").to_frame().describe()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "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", + "
DISTRICTSDCOUNTYTOTHHHHPOPTOTPOPEMPRESSFDUMFDUHHINCQ1...hhldssftazgqpopemployment_densitytotal_acrescounty_iddensity_indexhousehold_densitytotal_householdstotal_employment
count 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000... 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 1453.000000 1454.000000 1454.000000 1454.000000
mean 14.908528 14.908528 3.835626 1793.688446 4816.408528 4917.978680 2168.684319 1122.798487 670.889959 508.134801... 1793.688446 727.500000 101.570151 9.596395 3146.071457 3.835626 2.279554 6.008186 1793.688446 2247.736589
std 8.701078 8.701078 2.040153 961.021405 2686.029808 2690.352928 1211.109335 854.895353 717.261660 378.753528... 961.021405 419.877958 393.886676 45.067313 16945.908840 2.040153 3.945717 8.565908 961.021405 3538.356220
min 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000... 0.000000 1.000000 -1.000000 0.000000 13.000000 1.000000 0.000000 0.000000 0.000000 0.000000
25% 8.000000 8.000000 3.000000 1200.250000 3288.250000 3384.500000 1460.500000 602.000000 144.500000 257.000000... 1200.250000 364.250000 5.000000 0.877829 230.000000 3.000000 0.550232 1.910701 1200.250000 482.000000
50% 15.000000 15.000000 4.000000 1681.500000 4504.500000 4577.000000 2016.000000 1034.000000 460.000000 434.000000... 1681.500000 727.500000 18.000000 2.158701 397.000000 4.000000 1.289224 3.939122 1681.500000 1005.500000
75% 20.750000 20.750000 5.000000 2259.750000 6033.750000 6098.500000 2735.500000 1496.000000 907.750000 674.750000... 2259.750000 1090.750000 71.000000 5.492696 883.500000 5.000000 2.337577 6.693238 2259.750000 2215.750000
max 34.000000 34.000000 9.000000 12542.000000 39671.000000 40020.000000 16799.000000 12413.000000 4920.000000 3754.000000... 12542.000000 1454.000000 7810.000000 877.564767 372520.000000 9.000000 46.360371 90.891304 12542.000000 37950.000000
\n", + "

8 rows \u00d7 48 columns

\n", + "
" + ], + "metadata": {}, + "output_type": "pyout", + "prompt_number": 4, + "text": [ + " DISTRICT SD COUNTY TOTHH HHPOP \\\n", + "count 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 \n", + "mean 14.908528 14.908528 3.835626 1793.688446 4816.408528 \n", + "std 8.701078 8.701078 2.040153 961.021405 2686.029808 \n", + "min 1.000000 1.000000 1.000000 0.000000 0.000000 \n", + "25% 8.000000 8.000000 3.000000 1200.250000 3288.250000 \n", + "50% 15.000000 15.000000 4.000000 1681.500000 4504.500000 \n", + "75% 20.750000 20.750000 5.000000 2259.750000 6033.750000 \n", + "max 34.000000 34.000000 9.000000 12542.000000 39671.000000 \n", + "\n", + " TOTPOP EMPRES SFDU MFDU HHINCQ1 \\\n", + "count 1454.000000 1454.000000 1454.000000 1454.000000 1454.000000 \n", + "mean 4917.978680 2168.684319 1122.798487 670.889959 508.134801 \n", + "std 2690.352928 1211.109335 854.895353 717.261660 378.753528 \n", + "min 0.000000 0.000000 0.000000 0.000000 0.000000 \n", + "25% 3384.500000 1460.500000 602.000000 144.500000 257.000000 \n", + "50% 4577.000000 2016.000000 1034.000000 460.000000 434.000000 \n", + "75% 6098.500000 2735.500000 1496.000000 907.750000 674.750000 \n", + "max 40020.000000 16799.000000 12413.000000 4920.000000 3754.000000 \n", + "\n", + " ... hhlds sftaz gqpop \\\n", + "count ... 1454.000000 1454.000000 1454.000000 \n", + "mean ... 1793.688446 727.500000 101.570151 \n", + "std ... 961.021405 419.877958 393.886676 \n", + "min ... 0.000000 1.000000 -1.000000 \n", + "25% ... 1200.250000 364.250000 5.000000 \n", + "50% ... 1681.500000 727.500000 18.000000 \n", + "75% ... 2259.750000 1090.750000 71.000000 \n", + "max ... 12542.000000 1454.000000 7810.000000 \n", + "\n", + " employment_density total_acres county_id density_index \\\n", + "count 1454.000000 1454.000000 1454.000000 1453.000000 \n", + "mean 9.596395 3146.071457 3.835626 2.279554 \n", + "std 45.067313 16945.908840 2.040153 3.945717 \n", + "min 0.000000 13.000000 1.000000 0.000000 \n", + "25% 0.877829 230.000000 3.000000 0.550232 \n", + "50% 2.158701 397.000000 4.000000 1.289224 \n", + "75% 5.492696 883.500000 5.000000 2.337577 \n", + "max 877.564767 372520.000000 9.000000 46.360371 \n", + "\n", + " household_density total_households total_employment \n", + "count 1454.000000 1454.000000 1454.000000 \n", + "mean 6.008186 1793.688446 2247.736589 \n", + "std 8.565908 961.021405 3538.356220 \n", + "min 0.000000 0.000000 0.000000 \n", + "25% 1.910701 1200.250000 482.000000 \n", + "50% 3.939122 1681.500000 1005.500000 \n", + "75% 6.693238 2259.750000 2215.750000 \n", + "max 90.891304 12542.000000 37950.000000 \n", + "\n", + "[8 rows x 48 columns]" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "sim.get_table(\"households\").to_frame().describe()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "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", + "
TAZSERIALNOPUMA5incomePERSONSHHTUNITTYPENOCBLDGSZTENURE...bucketBinoriginalPUMAhmultiunitnum_young_adultsdriversnum_childrennum_adolescentsincome_in_thousandsnum_young_childrennum_college_age
count 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000... 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000 100000.000000
mean 752.439040 4924260.422350 2168.287950 77684.096720 2.580780 2.642540 0.077640 0.468280 3.529460 1.892780... 4.484880 2168.287950 0.401800 0.394180 2.063810 0.357290 0.060680 77.684097 0.159680 0.226650
std 430.258155 2863687.886756 516.271349 81341.474187 1.606362 2.066835 0.367387 0.913982 2.517375 1.010353... 2.871932 516.271349 0.490264 0.728922 1.122662 0.760368 0.260074 81.341474 0.462498 0.589748
min 1.000000 496.000000 1000.000000 -20000.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000... 0.000000 1000.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -20.000000 0.000000 0.000000
25% 374.000000 2456274.500000 2104.000000 26500.000000 1.000000 1.000000 0.000000 0.000000 2.000000 1.000000... 2.000000 2104.000000 0.000000 0.000000 1.000000 0.000000 0.000000 26.500000 0.000000 0.000000
50% 764.000000 4895910.500000 2303.000000 58000.000000 2.000000 1.000000 0.000000 0.000000 2.000000 2.000000... 4.000000 2303.000000 0.000000 0.000000 2.000000 0.000000 0.000000 58.000000 0.000000 0.000000
75% 1144.000000 7357629.750000 2410.000000 100000.000000 4.000000 4.000000 0.000000 1.000000 5.000000 3.000000... 7.000000 2410.000000 1.000000 1.000000 2.000000 0.000000 0.000000 100.000000 0.000000 0.000000
max 1454.000000 9999811.000000 2714.000000 1237000.000000 25.000000 7.000000 2.000000 10.000000 10.000000 4.000000... 9.000000 2714.000000 1.000000 9.000000 25.000000 8.000000 5.000000 1237.000000 8.000000 24.000000
\n", + "

8 rows \u00d7 53 columns

\n", + "
" + ], + "metadata": {}, + "output_type": "pyout", + "prompt_number": 5, + "text": [ + " TAZ SERIALNO PUMA5 income \\\n", + "count 100000.000000 100000.000000 100000.000000 100000.000000 \n", + "mean 752.439040 4924260.422350 2168.287950 77684.096720 \n", + "std 430.258155 2863687.886756 516.271349 81341.474187 \n", + "min 1.000000 496.000000 1000.000000 -20000.000000 \n", + "25% 374.000000 2456274.500000 2104.000000 26500.000000 \n", + "50% 764.000000 4895910.500000 2303.000000 58000.000000 \n", + "75% 1144.000000 7357629.750000 2410.000000 100000.000000 \n", + "max 1454.000000 9999811.000000 2714.000000 1237000.000000 \n", + "\n", + " PERSONS HHT UNITTYPE NOC \\\n", + "count 100000.000000 100000.000000 100000.000000 100000.000000 \n", + "mean 2.580780 2.642540 0.077640 0.468280 \n", + "std 1.606362 2.066835 0.367387 0.913982 \n", + "min 1.000000 0.000000 0.000000 0.000000 \n", + "25% 1.000000 1.000000 0.000000 0.000000 \n", + "50% 2.000000 1.000000 0.000000 0.000000 \n", + "75% 4.000000 4.000000 0.000000 1.000000 \n", + "max 25.000000 7.000000 2.000000 10.000000 \n", + "\n", + " BLDGSZ TENURE ... bucketBin \\\n", + "count 100000.000000 100000.000000 ... 100000.000000 \n", + "mean 3.529460 1.892780 ... 4.484880 \n", + "std 2.517375 1.010353 ... 2.871932 \n", + "min 0.000000 0.000000 ... 0.000000 \n", + "25% 2.000000 1.000000 ... 2.000000 \n", + "50% 2.000000 2.000000 ... 4.000000 \n", + "75% 5.000000 3.000000 ... 7.000000 \n", + "max 10.000000 4.000000 ... 9.000000 \n", + "\n", + " originalPUMA hmultiunit num_young_adults drivers \\\n", + "count 100000.000000 100000.000000 100000.000000 100000.000000 \n", + "mean 2168.287950 0.401800 0.394180 2.063810 \n", + "std 516.271349 0.490264 0.728922 1.122662 \n", + "min 1000.000000 0.000000 0.000000 0.000000 \n", + "25% 2104.000000 0.000000 0.000000 1.000000 \n", + "50% 2303.000000 0.000000 0.000000 2.000000 \n", + "75% 2410.000000 1.000000 1.000000 2.000000 \n", + "max 2714.000000 1.000000 9.000000 25.000000 \n", + "\n", + " num_children num_adolescents income_in_thousands \\\n", + "count 100000.000000 100000.000000 100000.000000 \n", + "mean 0.357290 0.060680 77.684097 \n", + "std 0.760368 0.260074 81.341474 \n", + "min 0.000000 0.000000 -20.000000 \n", + "25% 0.000000 0.000000 26.500000 \n", + "50% 0.000000 0.000000 58.000000 \n", + "75% 0.000000 0.000000 100.000000 \n", + "max 8.000000 5.000000 1237.000000 \n", + "\n", + " num_young_children num_college_age \n", + "count 100000.000000 100000.000000 \n", + "mean 0.159680 0.226650 \n", + "std 0.462498 0.589748 \n", + "min 0.000000 0.000000 \n", + "25% 0.000000 0.000000 \n", + "50% 0.000000 0.000000 \n", + "75% 0.000000 0.000000 \n", + "max 8.000000 24.000000 \n", + "\n", + "[8 rows x 53 columns]" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file