diff --git a/sb125_analyses/quick_mts_jobs/quick_mts_jobs.ipynb b/sb125_analyses/quick_mts_jobs/quick_mts_jobs.ipynb
index 1529cd867..8a0f54ae7 100644
--- a/sb125_analyses/quick_mts_jobs/quick_mts_jobs.ipynb
+++ b/sb125_analyses/quick_mts_jobs/quick_mts_jobs.ipynb
@@ -24,6 +24,26 @@
"hqta = gpd.read_parquet(HQTA_PATH)"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "e2c29312-9548-45f0-bfc8-ff4e96b76402",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "processed_census_path = 'gs://calitp-analytics-data/data-analyses/sb125/quick_mts_jobs/'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "9af25b42-98a2-4bd1-bfc0-9009a8fc1f47",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from calitp_data_analysis.utils import geoparquet_gcs_export"
+ ]
+ },
{
"cell_type": "markdown",
"id": "91f5ac1e-dc4d-447c-9aa1-4a58fb822ff3",
@@ -40,7 +60,6 @@
"cell_type": "markdown",
"id": "cbb60432-979b-4727-b7d6-392d5ef393bb",
"metadata": {
- "jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@@ -49,20 +68,20 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"id": "2dfaa4c9-fcc4-44e4-b2e8-af087d6b9b4d",
"metadata": {},
"outputs": [],
"source": [
"import gzip\n",
"# all workers, all primary jobs\n",
- "with gzip.open('./quick_mts_jobs/ca_wac_S000_JT01_2021.csv.gz', 'rb') as f:\n",
+ "with gzip.open('./ca_wac_S000_JT01_2021.csv.gz', 'rb') as f:\n",
" df = pd.read_csv(f)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"id": "1a33d692-09ac-4851-bf2a-642f945ea826",
"metadata": {},
"outputs": [],
@@ -72,7 +91,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 9,
"id": "617ca48d-35d2-4da9-bd27-905399ed6b14",
"metadata": {},
"outputs": [],
@@ -82,19 +101,28 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 10,
"id": "f275434d-8a94-4c87-9057-7404a3e2dddc",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/tmp/ipykernel_352/3750344097.py:3: DtypeWarning: Columns (2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72) have mixed types. Specify dtype option on import or set low_memory=False.\n",
+ " df2 = pd.read_csv(f)\n"
+ ]
+ }
+ ],
"source": [
- "with zipfile.ZipFile('./quick_mts_jobs/DECENNIALPL2020.P1_2024-10-16T105517.zip', 'r') as myzip:\n",
+ "with zipfile.ZipFile('./DECENNIALPL2020.P1_2024-10-16T105517.zip', 'r') as myzip:\n",
" with myzip.open('DECENNIALPL2020.P1-Data.csv') as f:\n",
" df2 = pd.read_csv(f)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 11,
"id": "5b9e9f90-d997-4ddc-851e-55f9e94efde3",
"metadata": {},
"outputs": [],
@@ -104,7 +132,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"id": "6e74b3f9-1633-4646-bfda-c535f1074421",
"metadata": {},
"outputs": [],
@@ -114,7 +142,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 13,
"id": "df3bf725-177b-48eb-87d7-7d3cd7313ad7",
"metadata": {},
"outputs": [],
@@ -124,7 +152,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 14,
"id": "fb52c09c-f024-4118-85d4-3122485dc0d7",
"metadata": {},
"outputs": [],
@@ -134,49 +162,194 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 15,
"id": "ff8d931c-8dd2-48ad-ab72-d27a216146c8",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " GEO_ID | \n",
+ " NAME | \n",
+ " P1_001N | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 1 | \n",
+ " 60014001001000 | \n",
+ " Block 1000, Block Group 1, Census Tract 4001, ... | \n",
+ " 0 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 60014001001001 | \n",
+ " Block 1001, Block Group 1, Census Tract 4001, ... | \n",
+ " 0 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 60014001001002 | \n",
+ " Block 1002, Block Group 1, Census Tract 4001, ... | \n",
+ " 0 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " GEO_ID NAME P1_001N\n",
+ "1 60014001001000 Block 1000, Block Group 1, Census Tract 4001, ... 0\n",
+ "2 60014001001001 Block 1001, Block Group 1, Census Tract 4001, ... 0\n",
+ "3 60014001001002 Block 1002, Block Group 1, Census Tract 4001, ... 0"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"df2 >> head(3)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 16,
"id": "354459c3-9be8-47db-bb4e-7878cbae5e15",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "GEO_ID int64\n",
+ "NAME object\n",
+ "P1_001N int64\n",
+ "dtype: object"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"df2.dtypes"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 17,
"id": "31d44c92-2be5-4851-91ba-71d37a1017ee",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " w_geocode | \n",
+ " C000 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 60014001001003 | \n",
+ " 23 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 60014001001010 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 60014001001011 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " w_geocode C000\n",
+ "0 60014001001003 23\n",
+ "1 60014001001010 5\n",
+ "2 60014001001011 1"
+ ]
+ },
+ "execution_count": 17,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"df >> head(3)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 18,
"id": "c3377ae1-6be9-468d-a765-578cdf688a94",
"metadata": {
"tags": []
},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "w_geocode int64\n",
+ "C000 int64\n",
+ "dtype: object"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"df.dtypes"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 19,
"id": "cef7a4bd-d13a-4387-9f1a-8f5faecbb547",
"metadata": {},
"outputs": [],
@@ -186,47 +359,313 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 20,
"id": "4c1c0e5a-7f70-43d5-ae05-cd0fe334ae4b",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " GEO_ID | \n",
+ " NAME | \n",
+ " P1_001N | \n",
+ " w_geocode | \n",
+ " C000 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 60014001001003 | \n",
+ " Block 1003, Block Group 1, Census Tract 4001, ... | \n",
+ " 0 | \n",
+ " 60014001001003 | \n",
+ " 23 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 60014001001010 | \n",
+ " Block 1010, Block Group 1, Census Tract 4001, ... | \n",
+ " 130 | \n",
+ " 60014001001010 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 60014001001011 | \n",
+ " Block 1011, Block Group 1, Census Tract 4001, ... | \n",
+ " 153 | \n",
+ " 60014001001011 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 60014001001013 | \n",
+ " Block 1013, Block Group 1, Census Tract 4001, ... | \n",
+ " 21 | \n",
+ " 60014001001013 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 60014001001015 | \n",
+ " Block 1015, Block Group 1, Census Tract 4001, ... | \n",
+ " 20 | \n",
+ " 60014001001015 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " 252467 | \n",
+ " 61150411021031 | \n",
+ " Block 1031, Block Group 1, Census Tract 411.02... | \n",
+ " 200 | \n",
+ " 61150411021031 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " 252468 | \n",
+ " 61150411021035 | \n",
+ " Block 1035, Block Group 1, Census Tract 411.02... | \n",
+ " 91 | \n",
+ " 61150411021035 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " 252469 | \n",
+ " 61150411021037 | \n",
+ " Block 1037, Block Group 1, Census Tract 411.02... | \n",
+ " 21 | \n",
+ " 61150411021037 | \n",
+ " 9 | \n",
+ "
\n",
+ " \n",
+ " 252470 | \n",
+ " 61150411021039 | \n",
+ " Block 1039, Block Group 1, Census Tract 411.02... | \n",
+ " 54 | \n",
+ " 61150411021039 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " 252471 | \n",
+ " 61150411021047 | \n",
+ " Block 1047, Block Group 1, Census Tract 411.02... | \n",
+ " 135 | \n",
+ " 61150411021047 | \n",
+ " 33 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
252472 rows × 5 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " GEO_ID NAME \\\n",
+ "0 60014001001003 Block 1003, Block Group 1, Census Tract 4001, ... \n",
+ "1 60014001001010 Block 1010, Block Group 1, Census Tract 4001, ... \n",
+ "2 60014001001011 Block 1011, Block Group 1, Census Tract 4001, ... \n",
+ "3 60014001001013 Block 1013, Block Group 1, Census Tract 4001, ... \n",
+ "4 60014001001015 Block 1015, Block Group 1, Census Tract 4001, ... \n",
+ "... ... ... \n",
+ "252467 61150411021031 Block 1031, Block Group 1, Census Tract 411.02... \n",
+ "252468 61150411021035 Block 1035, Block Group 1, Census Tract 411.02... \n",
+ "252469 61150411021037 Block 1037, Block Group 1, Census Tract 411.02... \n",
+ "252470 61150411021039 Block 1039, Block Group 1, Census Tract 411.02... \n",
+ "252471 61150411021047 Block 1047, Block Group 1, Census Tract 411.02... \n",
+ "\n",
+ " P1_001N w_geocode C000 \n",
+ "0 0 60014001001003 23 \n",
+ "1 130 60014001001010 5 \n",
+ "2 153 60014001001011 1 \n",
+ "3 21 60014001001013 4 \n",
+ "4 20 60014001001015 3 \n",
+ "... ... ... ... \n",
+ "252467 200 61150411021031 5 \n",
+ "252468 91 61150411021035 3 \n",
+ "252469 21 61150411021037 9 \n",
+ "252470 54 61150411021039 4 \n",
+ "252471 135 61150411021047 33 \n",
+ "\n",
+ "[252472 rows x 5 columns]"
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"joined"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 21,
"id": "07d88a37-eabe-4052-a223-7e41f9c68b3f",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " agency_primary | \n",
+ " agency_secondary | \n",
+ " hqta_type | \n",
+ " hqta_details | \n",
+ " route_id | \n",
+ " base64_url_primary | \n",
+ " base64_url_secondary | \n",
+ " org_id_primary | \n",
+ " org_id_secondary | \n",
+ " geometry | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " Alameda-Contra Costa Transit District | \n",
+ " None | \n",
+ " hq_corridor_bus | \n",
+ " stop_along_hq_bus_corridor_single_operator | \n",
+ " 10 | \n",
+ " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... | \n",
+ " None | \n",
+ " recOZgevYf7Jimm9L | \n",
+ " None | \n",
+ " MULTIPOLYGON (((-122.09630 37.66978, -122.0963... | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " Alameda-Contra Costa Transit District | \n",
+ " None | \n",
+ " hq_corridor_bus | \n",
+ " stop_along_hq_bus_corridor_single_operator | \n",
+ " 12 | \n",
+ " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... | \n",
+ " None | \n",
+ " recOZgevYf7Jimm9L | \n",
+ " None | \n",
+ " MULTIPOLYGON (((-122.28456 37.79937, -122.2844... | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " Alameda-Contra Costa Transit District | \n",
+ " None | \n",
+ " hq_corridor_bus | \n",
+ " stop_along_hq_bus_corridor_single_operator | \n",
+ " 14 | \n",
+ " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... | \n",
+ " None | \n",
+ " recOZgevYf7Jimm9L | \n",
+ " None | \n",
+ " POLYGON ((-122.31124 37.80881, -122.31122 37.8... | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " agency_primary agency_secondary hqta_type \\\n",
+ "0 Alameda-Contra Costa Transit District None hq_corridor_bus \n",
+ "1 Alameda-Contra Costa Transit District None hq_corridor_bus \n",
+ "2 Alameda-Contra Costa Transit District None hq_corridor_bus \n",
+ "\n",
+ " hqta_details route_id \\\n",
+ "0 stop_along_hq_bus_corridor_single_operator 10 \n",
+ "1 stop_along_hq_bus_corridor_single_operator 12 \n",
+ "2 stop_along_hq_bus_corridor_single_operator 14 \n",
+ "\n",
+ " base64_url_primary base64_url_secondary \\\n",
+ "0 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... None \n",
+ "1 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... None \n",
+ "2 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... None \n",
+ "\n",
+ " org_id_primary org_id_secondary \\\n",
+ "0 recOZgevYf7Jimm9L None \n",
+ "1 recOZgevYf7Jimm9L None \n",
+ "2 recOZgevYf7Jimm9L None \n",
+ "\n",
+ " geometry \n",
+ "0 MULTIPOLYGON (((-122.09630 37.66978, -122.0963... \n",
+ "1 MULTIPOLYGON (((-122.28456 37.79937, -122.2844... \n",
+ "2 POLYGON ((-122.31124 37.80881, -122.31122 37.8... "
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"hqta >> head(3)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 24,
"id": "12463b53-68e3-4908-86d3-29cc3f3ad6e3",
"metadata": {},
"outputs": [],
"source": [
- "blocks = gpd.read_file('./quick_mts_jobs/tl_2020_06_tabblock20.zip')"
+ "blocks = gpd.read_file('./tl_2020_06_tabblock20.zip')"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 25,
"id": "9251e399-0c2d-4de3-a35f-da563d95bdb5",
"metadata": {},
"outputs": [],
"source": [
- "blocks = blocks >> select(_.GEOID20, _.POP20, _.geometry)"
+ "blocks = blocks >> select(_.GEOID20, _.POP20, _.HOUSING20, _.geometry)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 26,
"id": "68ab1dd0-f08c-4431-9ba9-6abd09af35cf",
"metadata": {},
"outputs": [],
@@ -236,17 +675,17 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 31,
"id": "8e695d25-5850-4517-911c-70155efd6efc",
"metadata": {},
"outputs": [],
"source": [
- "blocks = blocks >> rename(GEO_ID = _.GEOID)"
+ "blocks = blocks >> rename(GEO_ID = _.GEOID20)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 33,
"id": "f807f1ff-7716-4942-b719-1858dd821b52",
"metadata": {},
"outputs": [],
@@ -256,27 +695,247 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 34,
"id": "1647e255-f72a-4fb5-b209-f90850ad00cf",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " GEO_ID | \n",
+ " POP20 | \n",
+ " HOUSING20 | \n",
+ " geometry | \n",
+ " NAME | \n",
+ " P1_001N | \n",
+ " w_geocode | \n",
+ " C000 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 60650406112004 | \n",
+ " 165 | \n",
+ " 40 | \n",
+ " POLYGON ((-117.59180 33.97054, -117.59059 33.9... | \n",
+ " Block 2004, Block Group 2, Census Tract 406.11... | \n",
+ " 165 | \n",
+ " 60650406112004 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 61130101032011 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " POLYGON ((-121.53676 38.58855, -121.53421 38.5... | \n",
+ " Block 2011, Block Group 2, Census Tract 101.03... | \n",
+ " 0 | \n",
+ " 61130101032011 | \n",
+ " 503 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 61130115001002 | \n",
+ " 25 | \n",
+ " 18 | \n",
+ " POLYGON ((-122.25881 38.90023, -122.25799 38.8... | \n",
+ " Block 1002, Block Group 1, Census Tract 115, Y... | \n",
+ " 25 | \n",
+ " 61130115001002 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 61130107041021 | \n",
+ " 67 | \n",
+ " 20 | \n",
+ " POLYGON ((-121.75876 38.54680, -121.75874 38.5... | \n",
+ " Block 1021, Block Group 1, Census Tract 107.04... | \n",
+ " 67 | \n",
+ " 61130107041021 | \n",
+ " 7 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 61130112071032 | \n",
+ " 17 | \n",
+ " 7 | \n",
+ " POLYGON ((-121.82142 38.63702, -121.82142 38.6... | \n",
+ " Block 1032, Block Group 1, Census Tract 112.07... | \n",
+ " 17 | \n",
+ " 61130112071032 | \n",
+ " 18 | \n",
+ "
\n",
+ " \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ "
\n",
+ " \n",
+ " 252467 | \n",
+ " 60890123012008 | \n",
+ " 138 | \n",
+ " 61 | \n",
+ " POLYGON ((-122.38878 40.49293, -122.38834 40.4... | \n",
+ " Block 2008, Block Group 2, Census Tract 123.01... | \n",
+ " 138 | \n",
+ " 60890123012008 | \n",
+ " 10 | \n",
+ "
\n",
+ " \n",
+ " 252468 | \n",
+ " 60770011011017 | \n",
+ " 94 | \n",
+ " 34 | \n",
+ " POLYGON ((-121.32608 37.97434, -121.32569 37.9... | \n",
+ " Block 1017, Block Group 1, Census Tract 11.01,... | \n",
+ " 94 | \n",
+ " 60770011011017 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " 252469 | \n",
+ " 60014402001014 | \n",
+ " 43 | \n",
+ " 16 | \n",
+ " POLYGON ((-122.01943 37.60060, -122.01904 37.6... | \n",
+ " Block 1014, Block Group 1, Census Tract 4402, ... | \n",
+ " 43 | \n",
+ " 60014402001014 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " 252470 | \n",
+ " 60590630072015 | \n",
+ " 119 | \n",
+ " 54 | \n",
+ " POLYGON ((-117.86737 33.63054, -117.86736 33.6... | \n",
+ " Block 2015, Block Group 2, Census Tract 630.07... | \n",
+ " 119 | \n",
+ " 60590630072015 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " 252471 | \n",
+ " 60376013033003 | \n",
+ " 440 | \n",
+ " 221 | \n",
+ " POLYGON ((-118.36499 33.97686, -118.36407 33.9... | \n",
+ " Block 3003, Block Group 3, Census Tract 6013.0... | \n",
+ " 440 | \n",
+ " 60376013033003 | \n",
+ " 33 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
252472 rows × 8 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " GEO_ID POP20 HOUSING20 \\\n",
+ "0 60650406112004 165 40 \n",
+ "1 61130101032011 0 0 \n",
+ "2 61130115001002 25 18 \n",
+ "3 61130107041021 67 20 \n",
+ "4 61130112071032 17 7 \n",
+ "... ... ... ... \n",
+ "252467 60890123012008 138 61 \n",
+ "252468 60770011011017 94 34 \n",
+ "252469 60014402001014 43 16 \n",
+ "252470 60590630072015 119 54 \n",
+ "252471 60376013033003 440 221 \n",
+ "\n",
+ " geometry \\\n",
+ "0 POLYGON ((-117.59180 33.97054, -117.59059 33.9... \n",
+ "1 POLYGON ((-121.53676 38.58855, -121.53421 38.5... \n",
+ "2 POLYGON ((-122.25881 38.90023, -122.25799 38.8... \n",
+ "3 POLYGON ((-121.75876 38.54680, -121.75874 38.5... \n",
+ "4 POLYGON ((-121.82142 38.63702, -121.82142 38.6... \n",
+ "... ... \n",
+ "252467 POLYGON ((-122.38878 40.49293, -122.38834 40.4... \n",
+ "252468 POLYGON ((-121.32608 37.97434, -121.32569 37.9... \n",
+ "252469 POLYGON ((-122.01943 37.60060, -122.01904 37.6... \n",
+ "252470 POLYGON ((-117.86737 33.63054, -117.86736 33.6... \n",
+ "252471 POLYGON ((-118.36499 33.97686, -118.36407 33.9... \n",
+ "\n",
+ " NAME P1_001N \\\n",
+ "0 Block 2004, Block Group 2, Census Tract 406.11... 165 \n",
+ "1 Block 2011, Block Group 2, Census Tract 101.03... 0 \n",
+ "2 Block 1002, Block Group 1, Census Tract 115, Y... 25 \n",
+ "3 Block 1021, Block Group 1, Census Tract 107.04... 67 \n",
+ "4 Block 1032, Block Group 1, Census Tract 112.07... 17 \n",
+ "... ... ... \n",
+ "252467 Block 2008, Block Group 2, Census Tract 123.01... 138 \n",
+ "252468 Block 1017, Block Group 1, Census Tract 11.01,... 94 \n",
+ "252469 Block 1014, Block Group 1, Census Tract 4402, ... 43 \n",
+ "252470 Block 2015, Block Group 2, Census Tract 630.07... 119 \n",
+ "252471 Block 3003, Block Group 3, Census Tract 6013.0... 440 \n",
+ "\n",
+ " w_geocode C000 \n",
+ "0 60650406112004 4 \n",
+ "1 61130101032011 503 \n",
+ "2 61130115001002 1 \n",
+ "3 61130107041021 7 \n",
+ "4 61130112071032 18 \n",
+ "... ... ... \n",
+ "252467 60890123012008 10 \n",
+ "252468 60770011011017 1 \n",
+ "252469 60014402001014 5 \n",
+ "252470 60590630072015 5 \n",
+ "252471 60376013033003 33 \n",
+ "\n",
+ "[252472 rows x 8 columns]"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"joined"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 35,
"id": "389cd2e2-9141-4944-842d-472efa097d89",
"metadata": {},
"outputs": [],
"source": [
- "joined = joined >> select(_.geoid == _.GEO_ID, _.pop == _.POP20, _.jobs == _.C000, _.geometry)"
+ "joined = joined >> select(_.geoid == _.GEO_ID, _.pop == _.POP20, _.jobs == _.C000,\n",
+ " _.housing == _.HOUSING20, _.geometry)"
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 36,
"id": "8f5c9d53-17f1-43b0-871d-4f6d3d443915",
"metadata": {},
"outputs": [],
@@ -284,6 +943,16 @@
"joined.to_parquet('census_jobs_blocks.parquet')"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "id": "ec2f1f5e-797e-41bf-892b-7d0816d651cb",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "geoparquet_gcs_export(joined, processed_census_path, 'census_jobs_blocks.parquet')"
+ ]
+ },
{
"cell_type": "markdown",
"id": "8c99bcc6-7ebd-445b-ba6b-3f723f02548a",
@@ -296,27 +965,17 @@
},
{
"cell_type": "code",
- "execution_count": 39,
- "id": "e2c29312-9548-45f0-bfc8-ff4e96b76402",
- "metadata": {},
- "outputs": [],
- "source": [
- "processed_census_path = 'gs://calitp-analytics-data/data-analyses/sb125/quick_mts_jobs/census_jobs_blocks.parquet'"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 40,
+ "execution_count": 38,
"id": "83a114dc-7c0c-499a-8dd2-d8fc22598bf7",
"metadata": {},
"outputs": [],
"source": [
- "census = gpd.read_parquet(processed_census_path).rename(columns={'pop': 'people'})"
+ "census = gpd.read_parquet(f'{processed_census_path}census_jobs_blocks.parquet').rename(columns={'pop': 'people'})"
]
},
{
"cell_type": "code",
- "execution_count": 41,
+ "execution_count": 39,
"id": "8b7f2f62-b63a-4ca4-95b4-fddd169b4cb6",
"metadata": {},
"outputs": [
@@ -344,6 +1003,7 @@
" geoid | \n",
" people | \n",
" jobs | \n",
+ " housing | \n",
" geometry | \n",
" \n",
" \n",
@@ -353,6 +1013,7 @@
" 60650406112004 | \n",
" 165 | \n",
" 4 | \n",
+ " 40 | \n",
" POLYGON ((-117.59180 33.97054, -117.59059 33.9... | \n",
" \n",
" \n",
@@ -360,6 +1021,7 @@
" 61130101032011 | \n",
" 0 | \n",
" 503 | \n",
+ " 0 | \n",
" POLYGON ((-121.53676 38.58855, -121.53421 38.5... | \n",
"
\n",
" \n",
@@ -367,6 +1029,7 @@
" 61130115001002 | \n",
" 25 | \n",
" 1 | \n",
+ " 18 | \n",
" POLYGON ((-122.25881 38.90023, -122.25799 38.8... | \n",
"
\n",
" \n",
@@ -374,10 +1037,10 @@
""
],
"text/plain": [
- " geoid people jobs \\\n",
- "0 60650406112004 165 4 \n",
- "1 61130101032011 0 503 \n",
- "2 61130115001002 25 1 \n",
+ " geoid people jobs housing \\\n",
+ "0 60650406112004 165 4 40 \n",
+ "1 61130101032011 0 503 0 \n",
+ "2 61130115001002 25 1 18 \n",
"\n",
" geometry \n",
"0 POLYGON ((-117.59180 33.97054, -117.59059 33.9... \n",
@@ -385,7 +1048,7 @@
"2 POLYGON ((-122.25881 38.90023, -122.25799 38.8... "
]
},
- "execution_count": 41,
+ "execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
@@ -396,7 +1059,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": 40,
"id": "aaabeb5d-80f2-4c58-ba37-e6e580792013",
"metadata": {},
"outputs": [],
@@ -406,7 +1069,7 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 41,
"id": "d945c5b5-b836-44e2-9a18-5a1fce9e377e",
"metadata": {},
"outputs": [],
@@ -416,7 +1079,7 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 42,
"id": "3618e30f-e55c-452d-b73b-152e85a31261",
"metadata": {},
"outputs": [],
@@ -426,7 +1089,7 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": 43,
"id": "8cab1c45-9271-468c-a926-4a5641a95c70",
"metadata": {},
"outputs": [],
@@ -436,7 +1099,7 @@
},
{
"cell_type": "code",
- "execution_count": 25,
+ "execution_count": 44,
"id": "18d6c363-0373-4692-bba4-7a56b078ef49",
"metadata": {},
"outputs": [],
@@ -446,7 +1109,7 @@
},
{
"cell_type": "code",
- "execution_count": 26,
+ "execution_count": 45,
"id": "f267f605-034e-4bb7-983f-5112dab47bb0",
"metadata": {},
"outputs": [],
@@ -456,7 +1119,7 @@
},
{
"cell_type": "code",
- "execution_count": 27,
+ "execution_count": 46,
"id": "3775a378-f75c-4a38-8eaa-3443399e9694",
"metadata": {},
"outputs": [
@@ -489,6 +1152,7 @@
" geoid | \n",
" people | \n",
" jobs | \n",
+ " housing | \n",
" \n",
" \n",
" \n",
@@ -502,6 +1166,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
" \n",
" \n",
" 17 | \n",
@@ -513,6 +1178,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" 20 | \n",
@@ -524,6 +1190,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" 26 | \n",
@@ -535,6 +1202,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" 33 | \n",
@@ -546,6 +1214,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" ... | \n",
@@ -557,6 +1226,7 @@
" ... | \n",
" ... | \n",
" ... | \n",
+ " ... | \n",
"
\n",
" \n",
" 49138 | \n",
@@ -568,6 +1238,7 @@
" 60971527023005 | \n",
" 0 | \n",
" 560 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49137 | \n",
@@ -579,6 +1250,7 @@
" 60971527024015 | \n",
" 0 | \n",
" 19 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49138 | \n",
@@ -590,6 +1262,7 @@
" 60971527024015 | \n",
" 0 | \n",
" 19 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49137 | \n",
@@ -601,6 +1274,7 @@
" 60971527023000 | \n",
" 0 | \n",
" 549 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49138 | \n",
@@ -612,10 +1286,11 @@
" 60971527023000 | \n",
" 0 | \n",
" 549 | \n",
+ " 0 | \n",
"
\n",
" \n",
"\n",
- "4478470 rows × 8 columns
\n",
+ "4478470 rows × 9 columns
\n",
""
],
"text/plain": [
@@ -645,23 +1320,23 @@
"49137 POLYGON ((-241654.554 58414.730, -241658.430 5... 232450 \n",
"49138 POLYGON ((-241654.223 58414.285, -241658.099 5... 232450 \n",
"\n",
- " geoid people jobs \n",
- "0 60014366012001 523 8 \n",
- "17 60014366012001 523 8 \n",
- "20 60014366012001 523 8 \n",
- "26 60014366012001 523 8 \n",
- "33 60014366012001 523 8 \n",
- "... ... ... ... \n",
- "49138 60971527023005 0 560 \n",
- "49137 60971527024015 0 19 \n",
- "49138 60971527024015 0 19 \n",
- "49137 60971527023000 0 549 \n",
- "49138 60971527023000 0 549 \n",
+ " geoid people jobs housing \n",
+ "0 60014366012001 523 8 172 \n",
+ "17 60014366012001 523 8 172 \n",
+ "20 60014366012001 523 8 172 \n",
+ "26 60014366012001 523 8 172 \n",
+ "33 60014366012001 523 8 172 \n",
+ "... ... ... ... ... \n",
+ "49138 60971527023005 0 560 0 \n",
+ "49137 60971527024015 0 19 0 \n",
+ "49138 60971527024015 0 19 0 \n",
+ "49137 60971527023000 0 549 0 \n",
+ "49138 60971527023000 0 549 0 \n",
"\n",
- "[4478470 rows x 8 columns]"
+ "[4478470 rows x 9 columns]"
]
},
- "execution_count": 27,
+ "execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
@@ -672,7 +1347,7 @@
},
{
"cell_type": "code",
- "execution_count": 28,
+ "execution_count": 47,
"id": "624a8b6d-12e6-4c06-8c5f-e56176002f71",
"metadata": {},
"outputs": [],
@@ -682,7 +1357,7 @@
},
{
"cell_type": "code",
- "execution_count": 29,
+ "execution_count": 48,
"id": "e5ef48a1-006f-43af-8557-96f26e4e4a44",
"metadata": {},
"outputs": [
@@ -713,6 +1388,7 @@
" geoid | \n",
" people | \n",
" jobs | \n",
+ " housing | \n",
" \n",
" \n",
" \n",
@@ -724,6 +1400,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
" \n",
" \n",
" 17 | \n",
@@ -733,6 +1410,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" 20 | \n",
@@ -742,6 +1420,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" 26 | \n",
@@ -751,6 +1430,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" 33 | \n",
@@ -760,6 +1440,7 @@
" 60014366012001 | \n",
" 523 | \n",
" 8 | \n",
+ " 172 | \n",
"
\n",
" \n",
" ... | \n",
@@ -769,6 +1450,7 @@
" ... | \n",
" ... | \n",
" ... | \n",
+ " ... | \n",
"
\n",
" \n",
" 49138 | \n",
@@ -778,6 +1460,7 @@
" 60971527023005 | \n",
" 0 | \n",
" 560 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49137 | \n",
@@ -787,6 +1470,7 @@
" 60971527024015 | \n",
" 0 | \n",
" 19 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49138 | \n",
@@ -796,6 +1480,7 @@
" 60971527024015 | \n",
" 0 | \n",
" 19 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49137 | \n",
@@ -805,6 +1490,7 @@
" 60971527023000 | \n",
" 0 | \n",
" 549 | \n",
+ " 0 | \n",
"
\n",
" \n",
" 49138 | \n",
@@ -814,10 +1500,11 @@
" 60971527023000 | \n",
" 0 | \n",
" 549 | \n",
+ " 0 | \n",
"
\n",
" \n",
"\n",
- "4478470 rows × 6 columns
\n",
+ "4478470 rows × 7 columns
\n",
""
],
"text/plain": [
@@ -834,23 +1521,23 @@
"49137 49137 Sonoma-Marin Area Rail Transit District major_stop_rail \n",
"49138 49138 Sonoma-Marin Area Rail Transit District major_stop_rail \n",
"\n",
- " geoid people jobs \n",
- "0 60014366012001 523 8 \n",
- "17 60014366012001 523 8 \n",
- "20 60014366012001 523 8 \n",
- "26 60014366012001 523 8 \n",
- "33 60014366012001 523 8 \n",
- "... ... ... ... \n",
- "49138 60971527023005 0 560 \n",
- "49137 60971527024015 0 19 \n",
- "49138 60971527024015 0 19 \n",
- "49137 60971527023000 0 549 \n",
- "49138 60971527023000 0 549 \n",
+ " geoid people jobs housing \n",
+ "0 60014366012001 523 8 172 \n",
+ "17 60014366012001 523 8 172 \n",
+ "20 60014366012001 523 8 172 \n",
+ "26 60014366012001 523 8 172 \n",
+ "33 60014366012001 523 8 172 \n",
+ "... ... ... ... ... \n",
+ "49138 60971527023005 0 560 0 \n",
+ "49137 60971527024015 0 19 0 \n",
+ "49138 60971527024015 0 19 0 \n",
+ "49137 60971527023000 0 549 0 \n",
+ "49138 60971527023000 0 549 0 \n",
"\n",
- "[4478470 rows x 6 columns]"
+ "[4478470 rows x 7 columns]"
]
},
- "execution_count": 29,
+ "execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
@@ -861,17 +1548,21 @@
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": 49,
"id": "021be2a9-f51d-48ff-81d8-950eccbe722d",
"metadata": {},
"outputs": [],
"source": [
- "stop_grouped = sjoined >> group_by(_.index, _.agency_primary, _.hqta_type) >> summarize(total_jobs = _.jobs.sum(), total_people = _.people.sum(), n = _.shape[0])"
+ "stop_grouped = (sjoined >> group_by(_.index, _.agency_primary, _.hqta_type)\n",
+ " >> summarize(total_jobs = _.jobs.sum(), total_people = _.people.sum(), n = _.shape[0],\n",
+ " total_housing = _.housing.sum())\n",
+ " \n",
+ " )"
]
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": 50,
"id": "88d408e3-3dba-4f1f-a606-bdb46f9fabef",
"metadata": {},
"outputs": [
@@ -902,6 +1593,7 @@
" total_jobs | \n",
" total_people | \n",
" n | \n",
+ " total_housing | \n",
" \n",
" \n",
" \n",
@@ -913,6 +1605,7 @@
" 22751 | \n",
" 75998 | \n",
" 498 | \n",
+ " 28767 | \n",
" \n",
" \n",
" 1 | \n",
@@ -922,6 +1615,7 @@
" 137148 | \n",
" 153107 | \n",
" 1406 | \n",
+ " 79424 | \n",
"
\n",
" \n",
" 2 | \n",
@@ -931,6 +1625,7 @@
" 92457 | \n",
" 154659 | \n",
" 1241 | \n",
+ " 63141 | \n",
"
\n",
" \n",
" 3 | \n",
@@ -940,6 +1635,7 @@
" 136575 | \n",
" 142008 | \n",
" 1365 | \n",
+ " 69241 | \n",
"
\n",
" \n",
" 4 | \n",
@@ -949,6 +1645,7 @@
" 86300 | \n",
" 64626 | \n",
" 606 | \n",
+ " 29104 | \n",
"
\n",
" \n",
" ... | \n",
@@ -958,6 +1655,7 @@
" ... | \n",
" ... | \n",
" ... | \n",
+ " ... | \n",
"
\n",
" \n",
" 49222 | \n",
@@ -967,6 +1665,7 @@
" 5270 | \n",
" 9786 | \n",
" 66 | \n",
+ " 3300 | \n",
"
\n",
" \n",
" 49223 | \n",
@@ -976,6 +1675,7 @@
" 7762 | \n",
" 5839 | \n",
" 117 | \n",
+ " 1800 | \n",
"
\n",
" \n",
" 49224 | \n",
@@ -985,6 +1685,7 @@
" 6638 | \n",
" 4037 | \n",
" 47 | \n",
+ " 1286 | \n",
"
\n",
" \n",
" 49225 | \n",
@@ -994,6 +1695,7 @@
" 7391 | \n",
" 3190 | \n",
" 29 | \n",
+ " 1281 | \n",
"
\n",
" \n",
" 49226 | \n",
@@ -1003,10 +1705,11 @@
" 3845 | \n",
" 3957 | \n",
" 36 | \n",
+ " 1807 | \n",
"
\n",
" \n",
"\n",
- "49227 rows × 6 columns
\n",
+ "49227 rows × 7 columns
\n",
""
],
"text/plain": [
@@ -1023,23 +1726,23 @@
"49225 49229 Southern California Regional Rail Authority major_stop_rail \n",
"49226 49230 Southern California Regional Rail Authority major_stop_rail \n",
"\n",
- " total_jobs total_people n \n",
- "0 22751 75998 498 \n",
- "1 137148 153107 1406 \n",
- "2 92457 154659 1241 \n",
- "3 136575 142008 1365 \n",
- "4 86300 64626 606 \n",
- "... ... ... ... \n",
- "49222 5270 9786 66 \n",
- "49223 7762 5839 117 \n",
- "49224 6638 4037 47 \n",
- "49225 7391 3190 29 \n",
- "49226 3845 3957 36 \n",
+ " total_jobs total_people n total_housing \n",
+ "0 22751 75998 498 28767 \n",
+ "1 137148 153107 1406 79424 \n",
+ "2 92457 154659 1241 63141 \n",
+ "3 136575 142008 1365 69241 \n",
+ "4 86300 64626 606 29104 \n",
+ "... ... ... ... ... \n",
+ "49222 5270 9786 66 3300 \n",
+ "49223 7762 5839 117 1800 \n",
+ "49224 6638 4037 47 1286 \n",
+ "49225 7391 3190 29 1281 \n",
+ "49226 3845 3957 36 1807 \n",
"\n",
- "[49227 rows x 6 columns]"
+ "[49227 rows x 7 columns]"
]
},
- "execution_count": 31,
+ "execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
@@ -1050,7 +1753,7 @@
},
{
"cell_type": "code",
- "execution_count": 36,
+ "execution_count": 51,
"id": "17791638-a6a9-4c40-80bc-0fa1cd9315d7",
"metadata": {},
"outputs": [
@@ -1086,6 +1789,11 @@
" p50_jobs | \n",
" p80_jobs | \n",
" p95_jobs | \n",
+ " p5_housing | \n",
+ " p20_housing | \n",
+ " p50_housing | \n",
+ " p80_housing | \n",
+ " p95_housing | \n",
" \n",
" \n",
" \n",
@@ -1102,6 +1810,11 @@
" 15961.0 | \n",
" 49293.0 | \n",
" 188260.0 | \n",
+ " 1702.75 | \n",
+ " 3477.0 | \n",
+ " 8726.0 | \n",
+ " 28040.0 | \n",
+ " 81785.25 | \n",
" \n",
" \n",
" 1 | \n",
@@ -1116,6 +1829,11 @@
" 12188.5 | \n",
" 80472.4 | \n",
" 204147.0 | \n",
+ " 2334.85 | \n",
+ " 4954.4 | \n",
+ " 11311.0 | \n",
+ " 21936.0 | \n",
+ " 36266.90 | \n",
"
\n",
" \n",
" 2 | \n",
@@ -1130,6 +1848,11 @@
" 4878.0 | \n",
" 14676.0 | \n",
" 77209.0 | \n",
+ " 953.00 | \n",
+ " 2090.0 | \n",
+ " 3606.0 | \n",
+ " 7134.0 | \n",
+ " 17160.00 | \n",
"
\n",
" \n",
" 3 | \n",
@@ -1144,6 +1867,11 @@
" 14020.0 | \n",
" 123204.4 | \n",
" 134539.8 | \n",
+ " 103.60 | \n",
+ " 1582.0 | \n",
+ " 4143.0 | \n",
+ " 6762.8 | \n",
+ " 7761.00 | \n",
"
\n",
" \n",
" 4 | \n",
@@ -1158,6 +1886,11 @@
" 8994.0 | \n",
" 45033.0 | \n",
" 217600.0 | \n",
+ " 855.30 | \n",
+ " 2482.0 | \n",
+ " 5220.0 | \n",
+ " 15627.0 | \n",
+ " 32754.00 | \n",
"
\n",
" \n",
"\n",
@@ -1171,15 +1904,22 @@
"3 major_stop_ferry 154.00 2842.8 6523.0 10109.8 11707.00 602.0 \n",
"4 major_stop_rail 2227.70 6191.0 11971.0 25451.6 56594.00 1377.7 \n",
"\n",
- " p20_jobs p50_jobs p80_jobs p95_jobs \n",
- "0 6688.0 15961.0 49293.0 188260.0 \n",
- "1 3961.4 12188.5 80472.4 204147.0 \n",
- "2 2119.0 4878.0 14676.0 77209.0 \n",
- "3 1679.0 14020.0 123204.4 134539.8 \n",
- "4 3110.8 8994.0 45033.0 217600.0 "
+ " p20_jobs p50_jobs p80_jobs p95_jobs p5_housing p20_housing \\\n",
+ "0 6688.0 15961.0 49293.0 188260.0 1702.75 3477.0 \n",
+ "1 3961.4 12188.5 80472.4 204147.0 2334.85 4954.4 \n",
+ "2 2119.0 4878.0 14676.0 77209.0 953.00 2090.0 \n",
+ "3 1679.0 14020.0 123204.4 134539.8 103.60 1582.0 \n",
+ "4 3110.8 8994.0 45033.0 217600.0 855.30 2482.0 \n",
+ "\n",
+ " p50_housing p80_housing p95_housing \n",
+ "0 8726.0 28040.0 81785.25 \n",
+ "1 11311.0 21936.0 36266.90 \n",
+ "2 3606.0 7134.0 17160.00 \n",
+ "3 4143.0 6762.8 7761.00 \n",
+ "4 5220.0 15627.0 32754.00 "
]
},
- "execution_count": 36,
+ "execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
@@ -1190,7 +1930,10 @@
" p80_pop = _.total_people.quantile(.8), p95_pop = _.total_people.quantile(.95),\n",
" p5_jobs = _.total_jobs.quantile(.05),\n",
" p20_jobs = _.total_jobs.quantile(.2), p50_jobs = _.total_jobs.quantile(.5),\n",
- " p80_jobs = _.total_jobs.quantile(.8), p95_jobs = _.total_jobs.quantile(.95)\n",
+ " p80_jobs = _.total_jobs.quantile(.8), p95_jobs = _.total_jobs.quantile(.95),\n",
+ " p5_housing = _.total_housing.quantile(.05),\n",
+ " p20_housing = _.total_housing.quantile(.2), p50_housing = _.total_housing.quantile(.5),\n",
+ " p80_housing = _.total_housing.quantile(.8), p95_housing = _.total_housing.quantile(.95)\n",
" \n",
" )\n",
"by_type"
@@ -1198,7 +1941,7 @@
},
{
"cell_type": "code",
- "execution_count": 37,
+ "execution_count": 52,
"id": "faf99aef-67e3-48cc-9ccc-f89b9b0fedff",
"metadata": {},
"outputs": [
@@ -1235,6 +1978,11 @@
" p50_jobs | \n",
" p80_jobs | \n",
" p95_jobs | \n",
+ " p5_housing | \n",
+ " p20_housing | \n",
+ " p50_housing | \n",
+ " p80_housing | \n",
+ " p95_housing | \n",
" \n",
" \n",
" \n",
@@ -1252,6 +2000,11 @@
" 19717.0 | \n",
" 82938.0 | \n",
" 136575.00 | \n",
+ " 7271.00 | \n",
+ " 12737.0 | \n",
+ " 22534.0 | \n",
+ " 50777.0 | \n",
+ " 74095.00 | \n",
" \n",
" \n",
" 1 | \n",
@@ -1267,6 +2020,11 @@
" 12986.0 | \n",
" 14761.6 | \n",
" 16697.30 | \n",
+ " 1269.70 | \n",
+ " 2315.8 | \n",
+ " 3313.0 | \n",
+ " 3745.6 | \n",
+ " 4331.00 | \n",
"
\n",
" \n",
" 2 | \n",
@@ -1282,6 +2040,11 @@
" 10790.0 | \n",
" 19423.8 | \n",
" 123508.40 | \n",
+ " 1906.20 | \n",
+ " 4357.4 | \n",
+ " 9870.0 | \n",
+ " 14462.6 | \n",
+ " 22948.40 | \n",
"
\n",
" \n",
" 3 | \n",
@@ -1297,6 +2060,11 @@
" 1236.0 | \n",
" 1504.0 | \n",
" 2041.60 | \n",
+ " 753.90 | \n",
+ " 1185.4 | \n",
+ " 1438.0 | \n",
+ " 1531.6 | \n",
+ " 2448.20 | \n",
"
\n",
" \n",
" 4 | \n",
@@ -1312,6 +2080,11 @@
" 7259.0 | \n",
" 10440.0 | \n",
" 12140.80 | \n",
+ " 2258.40 | \n",
+ " 2632.0 | \n",
+ " 3227.0 | \n",
+ " 4185.6 | \n",
+ " 7122.75 | \n",
"
\n",
" \n",
" ... | \n",
@@ -1327,6 +2100,11 @@
" ... | \n",
" ... | \n",
" ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
+ " ... | \n",
"
\n",
" \n",
" 283 | \n",
@@ -1342,6 +2120,11 @@
" 8801.0 | \n",
" 8914.0 | \n",
" 10498.40 | \n",
+ " 0.00 | \n",
+ " 0.0 | \n",
+ " 189.0 | \n",
+ " 769.2 | \n",
+ " 1015.30 | \n",
"
\n",
" \n",
" 284 | \n",
@@ -1357,6 +2140,11 @@
" 4626.0 | \n",
" 12453.2 | \n",
" 16297.30 | \n",
+ " 358.05 | \n",
+ " 913.6 | \n",
+ " 1768.0 | \n",
+ " 3122.0 | \n",
+ " 4956.55 | \n",
"
\n",
" \n",
" 285 | \n",
@@ -1372,6 +2160,11 @@
" 15232.5 | \n",
" 28537.4 | \n",
" 33144.45 | \n",
+ " 106.00 | \n",
+ " 1624.0 | \n",
+ " 3605.5 | \n",
+ " 5528.0 | \n",
+ " 7018.20 | \n",
"
\n",
" \n",
" 286 | \n",
@@ -1387,6 +2180,11 @@
" 4282.0 | \n",
" 6514.0 | \n",
" 7734.95 | \n",
+ " 889.40 | \n",
+ " 1962.0 | \n",
+ " 2785.5 | \n",
+ " 3989.6 | \n",
+ " 4372.80 | \n",
"
\n",
" \n",
" 287 | \n",
@@ -1402,10 +2200,15 @@
" 6117.0 | \n",
" 11140.4 | \n",
" 34857.00 | \n",
+ " 33.00 | \n",
+ " 1257.8 | \n",
+ " 2096.5 | \n",
+ " 3097.2 | \n",
+ " 3901.75 | \n",
"
\n",
" \n",
"\n",
- "288 rows × 12 columns
\n",
+ "288 rows × 17 columns
\n",
""
],
"text/plain": [
@@ -1435,23 +2238,36 @@
"286 4546.0 6977.5 9425.0 11176.25 1362.65 2498.0 4282.0 \n",
"287 3029.6 5565.5 9434.2 11780.00 854.95 2498.8 6117.0 \n",
"\n",
- " p80_jobs p95_jobs \n",
- "0 82938.0 136575.00 \n",
- "1 14761.6 16697.30 \n",
- "2 19423.8 123508.40 \n",
- "3 1504.0 2041.60 \n",
- "4 10440.0 12140.80 \n",
- ".. ... ... \n",
- "283 8914.0 10498.40 \n",
- "284 12453.2 16297.30 \n",
- "285 28537.4 33144.45 \n",
- "286 6514.0 7734.95 \n",
- "287 11140.4 34857.00 \n",
+ " p80_jobs p95_jobs p5_housing p20_housing p50_housing p80_housing \\\n",
+ "0 82938.0 136575.00 7271.00 12737.0 22534.0 50777.0 \n",
+ "1 14761.6 16697.30 1269.70 2315.8 3313.0 3745.6 \n",
+ "2 19423.8 123508.40 1906.20 4357.4 9870.0 14462.6 \n",
+ "3 1504.0 2041.60 753.90 1185.4 1438.0 1531.6 \n",
+ "4 10440.0 12140.80 2258.40 2632.0 3227.0 4185.6 \n",
+ ".. ... ... ... ... ... ... \n",
+ "283 8914.0 10498.40 0.00 0.0 189.0 769.2 \n",
+ "284 12453.2 16297.30 358.05 913.6 1768.0 3122.0 \n",
+ "285 28537.4 33144.45 106.00 1624.0 3605.5 5528.0 \n",
+ "286 6514.0 7734.95 889.40 1962.0 2785.5 3989.6 \n",
+ "287 11140.4 34857.00 33.00 1257.8 2096.5 3097.2 \n",
+ "\n",
+ " p95_housing \n",
+ "0 74095.00 \n",
+ "1 4331.00 \n",
+ "2 22948.40 \n",
+ "3 2448.20 \n",
+ "4 7122.75 \n",
+ ".. ... \n",
+ "283 1015.30 \n",
+ "284 4956.55 \n",
+ "285 7018.20 \n",
+ "286 4372.80 \n",
+ "287 3901.75 \n",
"\n",
- "[288 rows x 12 columns]"
+ "[288 rows x 17 columns]"
]
},
- "execution_count": 37,
+ "execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
@@ -1462,7 +2278,10 @@
" p80_pop = _.total_people.quantile(.8), p95_pop = _.total_people.quantile(.95),\n",
" p5_jobs = _.total_jobs.quantile(.05),\n",
" p20_jobs = _.total_jobs.quantile(.2), p50_jobs = _.total_jobs.quantile(.5),\n",
- " p80_jobs = _.total_jobs.quantile(.8), p95_jobs = _.total_jobs.quantile(.95)\n",
+ " p80_jobs = _.total_jobs.quantile(.8), p95_jobs = _.total_jobs.quantile(.95),\n",
+ " p5_housing = _.total_housing.quantile(.05),\n",
+ " p20_housing = _.total_housing.quantile(.2), p50_housing = _.total_housing.quantile(.5),\n",
+ " p80_housing = _.total_housing.quantile(.8), p95_housing = _.total_housing.quantile(.95)\n",
" \n",
" )\n",
"by_type_operator"
@@ -1470,13 +2289,13 @@
},
{
"cell_type": "code",
- "execution_count": 38,
+ "execution_count": 53,
"id": "b37541b1-a5b7-4c5e-8a1b-ed619c1d7241",
"metadata": {},
"outputs": [],
"source": [
- "by_type.to_csv('pop_jobs_by_major_stop_type.csv')\n",
- "by_type_operator.to_csv('pop_jobs_by_major_stop_type_and_agency.csv')"
+ "by_type.to_csv('pop_jobs_housing_by_major_stop_type.csv')\n",
+ "by_type_operator.to_csv('pop_jobs_housing_by_major_stop_type_and_agency.csv')"
]
}
],