j40-cejst-2/data/data-pipeline/data_pipeline/ipython/generate_fuds_test_data.ipynb
Matt Bowen d5fbb802e8
Add FUDS ETL (#1817)
* Add spatial join method (#1871)

Since we'll need to figure out the tracts for a large number of points
in future tickets, add a utility to handle grabbing the tract geometries
and adding tract data to a point dataset.

* Add FUDS, also jupyter lab (#1871)

* Add YAML configs for FUDS (#1871)

* Allow input geoid to be optional (#1871)

* Add FUDS ETL, tests, test-datae noteobook (#1871)

This adds the ETL class for Formerly Used Defense Sites (FUDS). This is
different from most other ETLs since these FUDS are not provided by
tract, but instead by geographic point, so we need to assign FUDS to
tracts and then do calculations from there.

* Floats -> Ints, as I intended (#1871)

* Floats -> Ints, as I intended (#1871)

* Formatting fixes (#1871)

* Add test false positive GEOIDs (#1871)

* Add gdal binaries (#1871)

* Refactor pandas code to be more idiomatic (#1871)

Per Emma, the more pandas-y way of doing my counts is using np.where to
add the values i need, then groupby and size. It is definitely more
compact, and also I think more correct!

* Update configs per Emma suggestions (#1871)

* Type fixed! (#1871)

* Remove spurious import from vscode (#1871)

* Snapshot update after changing col name (#1871)

* Move up GDAL (#1871)

* Adjust geojson strategy (#1871)

* Try running census separately first (#1871)

* Fix import order (#1871)

* Cleanup cache strategy (#1871)

* Download census data from S3 instead of re-calculating (#1871)

* Clarify pandas code per Emma (#1871)
2022-08-16 13:28:39 -04:00

1488 lines
49 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "markdown",
"id": "8c11c900-b1e9-48c2-967d-7fd2eb85cac1",
"metadata": {},
"source": [
"# Generate FUDS test data\n",
"\n",
"Creating the fixture data for the Formerly Used Defense Sites (FUDS) is pretty involved. The below walks through creating the data and then eyeballing it so you can check your test results. So, if the FUDS updates and you want to generate new sample data for your tests, run this notebook."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "f8ab7cf7-3124-41f3-9c62-0633d7815686",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"from data_pipeline.etl.sources.geo_utils import add_tracts_for_geometries\n",
"import json\n",
"\n",
"# Add this project to the path\n",
"module_path = os.path.abspath(os.path.join(\"../..\"))\n",
"if module_path not in sys.path:\n",
" sys.path.append(module_path)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "f59dc003-7df1-48c2-9278-86e1f8c65355",
"metadata": {},
"outputs": [],
"source": [
"import geopandas as gpd\n",
"import pandas as pd\n",
"from data_pipeline.etl.sources.census.etl import CensusETL\n",
"from data_pipeline.etl.sources.us_army_fuds.etl import USArmyFUDS"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "598dfe82-04b9-4e9c-a74b-a18c9db6688c",
"metadata": {},
"outputs": [],
"source": [
"%load_ext lab_black"
]
},
{
"cell_type": "markdown",
"id": "53b68b92-e575-4404-b79d-7dceb302f588",
"metadata": {},
"source": [
"# Load the source data and census tract data"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "2c4e0d6b-1dab-4e0a-952b-6cf9b11700da",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2022-08-10 17:57:23,542 [data_pipeline.etl.sources.us_army_fuds.etl] INFO Starting data download.\n",
"2022-08-10 17:57:23,542 [data_pipeline.utils] INFO Downloading https://opendata.arcgis.com/api/v3/datasets/3f8354667d5b4b1b8ad7a6e00c3cf3b1_1/downloads/data?format=geojson&spatialRefId=4326&where=1%3D1\n"
]
}
],
"source": [
"# get the data\n",
"etl = USArmyFUDS()\n",
"etl.extract()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c5752c7e-174d-451c-b123-d41b805f11ff",
"metadata": {},
"outputs": [],
"source": [
"df = gpd.read_file(etl.DOWNLOAD_FILE_NAME, lowmemory=False)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "8b372cc7-e44b-4a3a-a482-50870138401f",
"metadata": {},
"outputs": [],
"source": [
"census_tracts = gpd.read_file(CensusETL.NATIONAL_TRACT_JSON_PATH)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "e211b168-faf9-4b2e-a654-126d11ce9367",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'geopandas.geodataframe.GeoDataFrame'>\n",
"RangeIndex: 74134 entries, 0 to 74133\n",
"Data columns (total 13 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 STATEFP10 74134 non-null object \n",
" 1 COUNTYFP10 74134 non-null object \n",
" 2 TRACTCE10 74134 non-null object \n",
" 3 GEOID10 74134 non-null object \n",
" 4 NAME10 74134 non-null object \n",
" 5 NAMELSAD10 74134 non-null object \n",
" 6 MTFCC10 74134 non-null object \n",
" 7 FUNCSTAT10 74134 non-null object \n",
" 8 ALAND10 74134 non-null int64 \n",
" 9 AWATER10 74134 non-null int64 \n",
" 10 INTPTLAT10 74134 non-null object \n",
" 11 INTPTLON10 74134 non-null object \n",
" 12 geometry 74134 non-null geometry\n",
"dtypes: geometry(1), int64(2), object(10)\n",
"memory usage: 7.4+ MB\n"
]
}
],
"source": [
"census_tracts.info()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "b8edbb53-b8d8-4a85-acc1-da880435f945",
"metadata": {},
"outputs": [],
"source": [
"census_tracts.set_index(\"GEOID10\", inplace=True)"
]
},
{
"cell_type": "markdown",
"id": "d5f5a152-dbaa-4c5b-93a9-813d92f9f504",
"metadata": {
"tags": []
},
"source": [
"# Generate the test data"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "5890aa7e-bce2-484e-ad52-a4b4742ea81d",
"metadata": {},
"outputs": [],
"source": [
"with open(etl.DOWNLOAD_FILE_NAME) as geojson:\n",
" raw_fuds_geojson = json.load(geojson)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "8977d7b4-6cdf-49e6-84b6-016576663a58",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/matt/.cache/pypoetry/virtualenvs/justice40-data-pipeline-IwBjhw-4-py3.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3524: FutureWarning: The `op` parameter is deprecated and will be removed in a future release. Please use the `predicate` parameter instead.\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n"
]
}
],
"source": [
"tract_df = add_tracts_for_geometries(df)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "2fdc8327-fea6-4e46-aceb-6e000e709716",
"metadata": {},
"outputs": [],
"source": [
"example_geoids = pd.read_csv(\n",
" \"../tests/sources/example/data/extract.csv\", dtype=\"object\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "4c642f03-aeac-450a-9ac1-51038d2002e0",
"metadata": {},
"outputs": [],
"source": [
"merged_exaple_data = pd.merge(\n",
" example_geoids[\"GEOID10_TRACT\"],\n",
" tract_df,\n",
" on=\"GEOID10_TRACT\",\n",
" how=\"left\",\n",
" indicator=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "1b3e5fff-41cd-4c6d-8f37-3ce2c0fe66bf",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>GEOID10_TRACT</th>\n",
" <th>OBJECTID</th>\n",
" <th>CENTROIDLAT</th>\n",
" <th>CENTROIDLONG</th>\n",
" <th>CLOSESTCITY</th>\n",
" <th>CONGRESSIONALDISTRICT</th>\n",
" <th>COUNTY</th>\n",
" <th>CURRENTOWNER</th>\n",
" <th>DODFUDSPROPERTYIDPK</th>\n",
" <th>ELIGIBILITY</th>\n",
" <th>...</th>\n",
" <th>STATE</th>\n",
" <th>STATUS</th>\n",
" <th>STATUSCODE</th>\n",
" <th>USACEDISTRICT</th>\n",
" <th>FISCALYEAR</th>\n",
" <th>PROPERTY_HISTORY</th>\n",
" <th>USACEDIVISION</th>\n",
" <th>geometry</th>\n",
" <th>index_right</th>\n",
" <th>_merge</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>15001021010</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>left_only</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>15001021402</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>left_only</td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
" <td>15009030402</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>left_only</td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
" <td>15009030800</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>left_only</td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
" <td>15007040604</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>left_only</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 35 columns</p>\n",
"</div>"
],
"text/plain": [
" GEOID10_TRACT OBJECTID CENTROIDLAT CENTROIDLONG CLOSESTCITY \\\n",
"21 15001021010 NaN NaN NaN NaN \n",
"32 15001021402 NaN NaN NaN NaN \n",
"36 15009030402 NaN NaN NaN NaN \n",
"37 15009030800 NaN NaN NaN NaN \n",
"41 15007040604 NaN NaN NaN NaN \n",
"\n",
" CONGRESSIONALDISTRICT COUNTY CURRENTOWNER DODFUDSPROPERTYIDPK ELIGIBILITY \\\n",
"21 NaN NaN NaN NaN NaN \n",
"32 NaN NaN NaN NaN NaN \n",
"36 NaN NaN NaN NaN NaN \n",
"37 NaN NaN NaN NaN NaN \n",
"41 NaN NaN NaN NaN NaN \n",
"\n",
" ... STATE STATUS STATUSCODE USACEDISTRICT FISCALYEAR PROPERTY_HISTORY \\\n",
"21 ... NaN NaN NaN NaN NaN NaN \n",
"32 ... NaN NaN NaN NaN NaN NaN \n",
"36 ... NaN NaN NaN NaN NaN NaN \n",
"37 ... NaN NaN NaN NaN NaN NaN \n",
"41 ... NaN NaN NaN NaN NaN NaN \n",
"\n",
" USACEDIVISION geometry index_right _merge \n",
"21 NaN None NaN left_only \n",
"32 NaN None NaN left_only \n",
"36 NaN None NaN left_only \n",
"37 NaN None NaN left_only \n",
"41 NaN None NaN left_only \n",
"\n",
"[5 rows x 35 columns]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"merged_exaple_data[merged_exaple_data[\"_merge\"] == \"left_only\"]"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "b97e3aa3-88d0-4748-b7bb-77365078ea38",
"metadata": {},
"outputs": [],
"source": [
"original_crs = census_tracts.crs\n",
"points = (\n",
" census_tracts.to_crs(epsg=3395)\n",
" .loc[\n",
" merged_exaple_data[(merged_exaple_data[\"_merge\"] == \"left_only\")]\n",
" .query('not GEOID10_TRACT.str.startswith(\"06\")')\n",
" .GEOID10_TRACT\n",
" ]\n",
" .centroid.to_crs(original_crs)\n",
" .to_dict()\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "a2ebcfec-ec7c-454e-ac0f-cee14a93989f",
"metadata": {},
"outputs": [],
"source": [
"object_ids_to_keep = set(\n",
" merged_exaple_data[merged_exaple_data[\"_merge\"] == \"both\"].OBJECTID.astype(\"int\")\n",
")\n",
"features = []\n",
"for feature in raw_fuds_geojson[\"features\"]:\n",
" if feature[\"properties\"][\"OBJECTID\"] in object_ids_to_keep:\n",
" features.append(feature)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "703bf1cd-e150-461d-8eed-ce35a593c28a",
"metadata": {},
"outputs": [],
"source": [
"def make_fake_feature(\n",
" state: str, has_projects: bool, is_eligible: bool, latitude: float, longitude: float\n",
"):\n",
" \"\"\"For tracts where we don't have a FUDS, fake one.\"\"\"\n",
" make_fake_feature._object_id += 1\n",
" return {\n",
" \"type\": \"Feature\",\n",
" \"properties\": {\n",
" \"OBJECTID\": make_fake_feature._object_id,\n",
" \"CENTROIDLAT\": None,\n",
" \"CENTROIDLONG\": None,\n",
" \"CLOSESTCITY\": None,\n",
" \"CONGRESSIONALDISTRICT\": \"15\",\n",
" \"COUNTY\": None,\n",
" \"CURRENTOWNER\": None,\n",
" \"DODFUDSPROPERTYIDPK\": \" \",\n",
" \"ELIGIBILITY\": \"Eligible\" if is_eligible else \"Ineligible\",\n",
" \"EMSMGMTACTIONPLANLINK\": \"https://fudsportal.usace.army.mil/ems/inventory/map?id=54113\",\n",
" \"EPAREGION\": \"06\",\n",
" \"FEATUREDESCRIPTION\": None,\n",
" \"FEATURENAME\": \"NEIL, ET AL, PROPERTIES\",\n",
" \"FUDSINSTALLATIONID\": None,\n",
" \"FUDSUNIQUEPROPERTYNUMBER\": \"K06TX1120\",\n",
" \"HASPROJECTS\": \"Yes\" if has_projects else \"No\",\n",
" \"LATITUDE\": latitude,\n",
" \"LONGITUDE\": longitude,\n",
" \"MEDIAID\": None,\n",
" \"METADATAID\": None,\n",
" \"NOFURTHERACTION\": None,\n",
" \"PROJECTREQUIRED\": \"No\",\n",
" \"SDSID\": None,\n",
" \"SITEELIGIBILITY\": None,\n",
" \"STATE\": state,\n",
" \"STATUS\": \"Properties with projects\"\n",
" if has_projects\n",
" else \"Properties without projects\",\n",
" \"STATUSCODE\": \"Not on the NPL\",\n",
" \"USACEDISTRICT\": \"swf\",\n",
" \"FISCALYEAR\": \"2019\",\n",
" \"PROPERTY_HISTORY\": None,\n",
" \"USACEDIVISION\": \"swd\",\n",
" },\n",
" \"geometry\": {\n",
" \"type\": \"Point\",\n",
" \"coordinates\": [longitude, latitude],\n",
" },\n",
" }\n",
"\n",
"\n",
"make_fake_feature._object_id = 50"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "5e020301-a22f-4b42-9aea-127c0d2fe718",
"metadata": {},
"outputs": [],
"source": [
"# Create FUDS in CA for each tract that doesn't have a FUDS\n",
"for tract_id, point in points.items():\n",
" for bools in [(True, True), (True, False), (False, False)]:\n",
" features.append(make_fake_feature(\"CA\", bools[0], bools[1], point.y, point.x))"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "eb278e9b-e86d-459b-8961-89696e8173ea",
"metadata": {},
"outputs": [],
"source": [
"test_fuds_geojson = raw_fuds_geojson.copy()\n",
"test_fuds_geojson[\"features\"] = features"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "01e7fea9-cd9e-4f62-b498-f1cb8cb30f04",
"metadata": {},
"outputs": [],
"source": [
"with open(\"../tests/sources/us_army_fuds/data/fuds.geojson\", \"w\") as outfile:\n",
" json.dump(test_fuds_geojson, outfile)"
]
},
{
"cell_type": "markdown",
"id": "5300ea7d-ecc7-4502-bda8-abe9bb183e13",
"metadata": {},
"source": [
"# Eyeball the data to check the results of the tests"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "3b912164-8b07-417b-93ff-4180823fe485",
"metadata": {},
"outputs": [],
"source": [
"test_frame = gpd.read_file(\"../tests/sources/us_army_fuds/data/fuds.geojson\")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "82603b6b-bf87-4b5c-9e17-0898ccbb43b3",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/matt/.cache/pypoetry/virtualenvs/justice40-data-pipeline-IwBjhw-4-py3.10/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3524: FutureWarning: The `op` parameter is deprecated and will be removed in a future release. Please use the `predicate` parameter instead.\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n"
]
}
],
"source": [
"test_frame_with_tracts_full = test_frame_with_tracts = add_tracts_for_geometries(\n",
" test_frame\n",
")"
]
},
{
"cell_type": "markdown",
"id": "6829ace4-0289-4d25-915e-4f95d00777ac",
"metadata": {},
"source": [
"## Pre-compute the long, lat: tract relationship for use in a mock in the tests"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "c085d3a6-dcb4-4f64-b654-68516e6268d1",
"metadata": {},
"outputs": [],
"source": [
"test_frame_with_tracts = test_frame_with_tracts.set_index(\n",
" [\"GEOID10_TRACT\", \"OBJECTID\"]\n",
")[[\"ELIGIBILITY\", \"HASPROJECTS\"]]"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "41f6649a-f31c-4fac-a72d-a38f79de499a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{(-121.39361572299998, 38.87463378900003): '06061021322',\n",
" (-121.40020751999998, 38.897583008000026): '06061021322',\n",
" (-121.40020751999998, 38.75158691400003): '06061021322',\n",
" (-157.84301757799997, 21.53619384800004): '15003010201',\n",
" (-157.85168456999997, 21.553405762000068): '15003010201',\n",
" (-157.90679931599996, 21.554199219000054): '15003010201',\n",
" (-159.52191162099996, 21.976623535000044): '15007040700',\n",
" (-159.52996826199998, 21.93762207000003): '15007040700',\n",
" (-159.52111816399997, 21.922607422000056): '15007040700',\n",
" (-156.14270019499997, 20.840393066000047): '15009030100',\n",
" (-155.85968017599998, 20.26519775400004): '15001021800',\n",
" (-155.73327636699997, 20.166809082000043): '15001021800',\n",
" (-155.89270019499997, 20.23522949200003): '15001021800',\n",
" (-156.26019287099996, 20.899414062000062): '15009030201',\n",
" (-156.22076415999996, 20.91241455100004): '15009030201',\n",
" (-156.20739746099997, 20.890991211000028): '15009030201',\n",
" (-159.46496581999997, 21.90460205100004): '15007040603',\n",
" (-159.46441650399998, 21.905212402000075): '15007040603',\n",
" (-154.82519531299997, 19.49182128900003): '15001021101',\n",
" (-121.06768798799999, 36.61480712900004): '06069000802',\n",
" (-117.391601563, 36.33343505900007): '06027000800',\n",
" (-117.85546874999994, 36.46960449200003): '06027000800',\n",
" (-117.23529052699996, 36.387634277000075): '06027000800',\n",
" (-118.15270996099997, 36.725219727000024): '06027000800',\n",
" (-118.13891601599994, 36.56683349600007): '06027000800',\n",
" (-117.311096191, 36.783386230000076): '06027000800',\n",
" (-118.00030517599998, 36.283813477000024): '06027000800',\n",
" (-116.86248779299996, 36.46124267600004): '06027000800',\n",
" (-117.16418456999997, 36.60681152300003): '06027000800',\n",
" (-117.06939697299998, 36.158386230000076): '06027000800',\n",
" (-117.873596191, 36.487609863000046): '06027000800',\n",
" (-116.82971191399997, 36.283386230000076): '06027000800',\n",
" (-117.21667480499997, 35.95843505900007): '06027000800',\n",
" (-118.04998779299996, 36.59478759800004): '06027000800',\n",
" (-117.03576660199997, 36.27801513700007): '06027000800',\n",
" (-116.10028076199995, 35.83380127000004): '06027000800',\n",
" (-117.86499023399995, 36.14422607400007): '06027000800',\n",
" (-155.10320912843935, 19.497857096442765): '15001021010',\n",
" (-155.91378674587037, 19.516632121497878): '15001021402',\n",
" (-156.3306524489697, 20.825377142028497): '15009030402',\n",
" (-156.5429023670438, 20.917074254751412): '15009030800',\n",
" (-159.48416820625405, 21.907546119100093): '15007040604'}"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tracts = test_frame_with_tracts_full[[\"GEOID10_TRACT\", \"geometry\"]].drop_duplicates()\n",
"tracts[\"lat_long\"] = test_frame_with_tracts_full.geometry.apply(\n",
" lambda point: (point.x, point.y)\n",
")\n",
"tracts.set_index(\"lat_long\")[\"GEOID10_TRACT\"].to_dict()"
]
},
{
"cell_type": "markdown",
"id": "22d109ae-9bc4-499f-9d58-1b7db2842a37",
"metadata": {},
"source": [
"## Look at the sample data itself"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "399b009a-8d52-4872-87ac-1aa1e82a7d67",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th>ELIGIBILITY</th>\n",
" <th>HASPROJECTS</th>\n",
" </tr>\n",
" <tr>\n",
" <th>GEOID10_TRACT</th>\n",
" <th>OBJECTID</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">06061021322</th>\n",
" <th>684</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1719</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7428</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15003010201</th>\n",
" <th>1538</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1629</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6062</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15007040700</th>\n",
" <th>2093</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2123</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6015</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15009030100</th>\n",
" <th>2217</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15001021800</th>\n",
" <th>4551</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4735</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5310</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15009030201</th>\n",
" <th>4622</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5292</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5832</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"2\" valign=\"top\">15007040603</th>\n",
" <th>4669</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6013</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15001021101</th>\n",
" <th>4694</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>06069000802</th>\n",
" <th>6974</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"17\" valign=\"top\">06027000800</th>\n",
" <th>7018</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7046</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7565</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7689</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7691</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7831</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7866</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7977</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8235</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8237</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8499</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8500</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8557</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8624</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8742</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9012</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9035</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15001021010</th>\n",
" <th>51</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>52</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>53</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15001021402</th>\n",
" <th>54</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>55</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>56</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15009030402</th>\n",
" <th>57</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>58</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>59</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15009030800</th>\n",
" <th>60</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>61</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15007040604</th>\n",
" <th>63</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>64</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>65</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" ELIGIBILITY HASPROJECTS\n",
"GEOID10_TRACT OBJECTID \n",
"06061021322 684 Eligible No\n",
" 1719 Eligible Yes\n",
" 7428 Eligible No\n",
"15003010201 1538 Eligible Yes\n",
" 1629 Eligible No\n",
" 6062 Eligible Yes\n",
"15007040700 2093 Eligible Yes\n",
" 2123 Eligible No\n",
" 6015 Eligible No\n",
"15009030100 2217 Eligible No\n",
"15001021800 4551 Eligible No\n",
" 4735 Eligible No\n",
" 5310 Eligible Yes\n",
"15009030201 4622 Eligible Yes\n",
" 5292 Eligible No\n",
" 5832 Eligible No\n",
"15007040603 4669 Eligible No\n",
" 6013 Eligible No\n",
"15001021101 4694 Eligible No\n",
"06069000802 6974 Eligible Yes\n",
"06027000800 7018 Eligible No\n",
" 7046 Ineligible No\n",
" 7565 Ineligible No\n",
" 7689 Eligible Yes\n",
" 7691 Eligible Yes\n",
" 7831 Ineligible No\n",
" 7866 Eligible No\n",
" 7977 Eligible No\n",
" 8235 Ineligible No\n",
" 8237 Ineligible No\n",
" 8499 Ineligible No\n",
" 8500 Ineligible No\n",
" 8557 Eligible No\n",
" 8624 Ineligible No\n",
" 8742 Ineligible No\n",
" 9012 Ineligible No\n",
" 9035 Eligible Yes\n",
"15001021010 51 Eligible Yes\n",
" 52 Ineligible Yes\n",
" 53 Ineligible No\n",
"15001021402 54 Eligible Yes\n",
" 55 Ineligible Yes\n",
" 56 Ineligible No\n",
"15009030402 57 Eligible Yes\n",
" 58 Ineligible Yes\n",
" 59 Ineligible No\n",
"15009030800 60 Eligible Yes\n",
" 61 Ineligible Yes\n",
" 62 Ineligible No\n",
"15007040604 63 Eligible Yes\n",
" 64 Ineligible Yes\n",
" 65 Ineligible No"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test_frame_with_tracts"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "2a48b84d-418e-4690-925e-ba397ab3b239",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th>ELIGIBILITY</th>\n",
" <th>HASPROJECTS</th>\n",
" </tr>\n",
" <tr>\n",
" <th>GEOID10_TRACT</th>\n",
" <th>OBJECTID</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"17\" valign=\"top\">06027000800</th>\n",
" <th>7018</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7046</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7565</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7689</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7691</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7831</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7866</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7977</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8235</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8237</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8499</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8500</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8557</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8624</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8742</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9012</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9035</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">06061021322</th>\n",
" <th>684</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1719</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7428</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>06069000802</th>\n",
" <th>6974</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15001021010</th>\n",
" <th>51</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>52</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>53</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15001021101</th>\n",
" <th>4694</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15001021402</th>\n",
" <th>54</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>55</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>56</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15001021800</th>\n",
" <th>4551</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4735</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5310</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15003010201</th>\n",
" <th>1538</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1629</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6062</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"2\" valign=\"top\">15007040603</th>\n",
" <th>4669</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6013</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15007040604</th>\n",
" <th>63</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>64</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>65</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15007040700</th>\n",
" <th>2093</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2123</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6015</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15009030100</th>\n",
" <th>2217</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15009030201</th>\n",
" <th>4622</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5292</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5832</th>\n",
" <td>Eligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15009030402</th>\n",
" <th>57</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>58</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>59</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">15009030800</th>\n",
" <th>60</th>\n",
" <td>Eligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>61</th>\n",
" <td>Ineligible</td>\n",
" <td>Yes</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62</th>\n",
" <td>Ineligible</td>\n",
" <td>No</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" ELIGIBILITY HASPROJECTS\n",
"GEOID10_TRACT OBJECTID \n",
"06027000800 7018 Eligible No\n",
" 7046 Ineligible No\n",
" 7565 Ineligible No\n",
" 7689 Eligible Yes\n",
" 7691 Eligible Yes\n",
" 7831 Ineligible No\n",
" 7866 Eligible No\n",
" 7977 Eligible No\n",
" 8235 Ineligible No\n",
" 8237 Ineligible No\n",
" 8499 Ineligible No\n",
" 8500 Ineligible No\n",
" 8557 Eligible No\n",
" 8624 Ineligible No\n",
" 8742 Ineligible No\n",
" 9012 Ineligible No\n",
" 9035 Eligible Yes\n",
"06061021322 684 Eligible No\n",
" 1719 Eligible Yes\n",
" 7428 Eligible No\n",
"06069000802 6974 Eligible Yes\n",
"15001021010 51 Eligible Yes\n",
" 52 Ineligible Yes\n",
" 53 Ineligible No\n",
"15001021101 4694 Eligible No\n",
"15001021402 54 Eligible Yes\n",
" 55 Ineligible Yes\n",
" 56 Ineligible No\n",
"15001021800 4551 Eligible No\n",
" 4735 Eligible No\n",
" 5310 Eligible Yes\n",
"15003010201 1538 Eligible Yes\n",
" 1629 Eligible No\n",
" 6062 Eligible Yes\n",
"15007040603 4669 Eligible No\n",
" 6013 Eligible No\n",
"15007040604 63 Eligible Yes\n",
" 64 Ineligible Yes\n",
" 65 Ineligible No\n",
"15007040700 2093 Eligible Yes\n",
" 2123 Eligible No\n",
" 6015 Eligible No\n",
"15009030100 2217 Eligible No\n",
"15009030201 4622 Eligible Yes\n",
" 5292 Eligible No\n",
" 5832 Eligible No\n",
"15009030402 57 Eligible Yes\n",
" 58 Ineligible Yes\n",
" 59 Ineligible No\n",
"15009030800 60 Eligible Yes\n",
" 61 Ineligible Yes\n",
" 62 Ineligible No"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test_frame_with_tracts.sort_index()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}