j40-cejst-2/data/data-pipeline/data_pipeline/ipython/geojson_compare_tiles.ipynb
Emma Nechamkin 1c4d3e4142
Score tests (#1847)
* update Python version on README; tuple typing fix

* Alaska tribal points fix (#1821)

* Bump mistune from 0.8.4 to 2.0.3 in /data/data-pipeline (#1777)

Bumps [mistune](https://github.com/lepture/mistune) from 0.8.4 to 2.0.3.
- [Release notes](https://github.com/lepture/mistune/releases)
- [Changelog](https://github.com/lepture/mistune/blob/master/docs/changes.rst)
- [Commits](https://github.com/lepture/mistune/compare/v0.8.4...v2.0.3)

---
updated-dependencies:
- dependency-name: mistune
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* poetry update

* initial pass of score tests

* add threshold tests

* added ses threshold (not donut, not island)

* testing suite -- stopping for the day

* added test for lead proxy indicator

* Refactor score tests to make them less verbose and more direct (#1865)

* Cleanup tests slightly before refactor (#1846)

* Refactor score calculations tests

* Feedback from review

* Refactor output tests like calculatoin tests (#1846) (#1870)

* Reorganize files (#1846)

* Switch from lru_cache to fixture scorpes (#1846)

* Add tests for all factors (#1846)

* Mark smoketests and run as part of be deply (#1846)

* Update renamed var (#1846)

* Switch from named tuple to dataclass (#1846)

This is annoying, but pylint in python3.8 was crashing parsing the named
tuple. We weren't using any namedtuple-specific features, so I made the
type a dataclass just to get pylint to behave.

* Add default timout to requests (#1846)

* Fix type (#1846)

* Fix merge mistake on poetry.lock (#1846)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jorge Escobar <jorge.e.escobar@omb.eop.gov>
Co-authored-by: Jorge Escobar <83969469+esfoobar-usds@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt Bowen <83967628+mattbowen-usds@users.noreply.github.com>
Co-authored-by: matt bowen <matthew.r.bowen@omb.eop.gov>
2022-08-26 15:23:20 -04:00

496 lines
12 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": "code",
"execution_count": 1,
"id": "27da604f",
"metadata": {},
"outputs": [],
"source": [
"# %load_ext lab_black\n",
"import json\n",
"import pandas as pd\n",
"import geopandas as gpd\n",
"\n",
"# Read in the above json file\n",
"nation=gpd.read_file(\"/Users/vims/Downloads/usa-high-1822-637b.json\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "7b7083fd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 None\n",
"1 None\n",
"2 None\n",
"3 None\n",
"4 None\n",
" ... \n",
"74129 None\n",
"74130 None\n",
"74131 None\n",
"74132 None\n",
"74133 None\n",
"Name: FUDS_RAW, Length: 74134, dtype: object"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation['FUDS_RAW']"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "117477e6",
"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</th>\n",
" <th>SF</th>\n",
" <th>CF</th>\n",
" <th>HRS_ET</th>\n",
" <th>AML_ET</th>\n",
" <th>AML_RAW</th>\n",
" <th>FUDS_ET</th>\n",
" <th>FUDS_RAW</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>27139080202</td>\n",
" <td>Minnesota</td>\n",
" <td>Scott County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>27139080204</td>\n",
" <td>Minnesota</td>\n",
" <td>Scott County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>27139080100</td>\n",
" <td>Minnesota</td>\n",
" <td>Scott County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>27139080302</td>\n",
" <td>Minnesota</td>\n",
" <td>Scott County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>27139080400</td>\n",
" <td>Minnesota</td>\n",
" <td>Scott County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74129</th>\n",
" <td>16005001601</td>\n",
" <td>Idaho</td>\n",
" <td>Bannock County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74130</th>\n",
" <td>16005001300</td>\n",
" <td>Idaho</td>\n",
" <td>Bannock County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74131</th>\n",
" <td>16005001000</td>\n",
" <td>Idaho</td>\n",
" <td>Bannock County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74132</th>\n",
" <td>16005000900</td>\n",
" <td>Idaho</td>\n",
" <td>Bannock County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74133</th>\n",
" <td>16005000800</td>\n",
" <td>Idaho</td>\n",
" <td>Bannock County</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" <td>False</td>\n",
" <td>None</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>74134 rows × 8 columns</p>\n",
"</div>"
],
"text/plain": [
" GEOID10 SF CF HRS_ET AML_ET AML_RAW FUDS_ET \\\n",
"0 27139080202 Minnesota Scott County None False None False \n",
"1 27139080204 Minnesota Scott County None False None False \n",
"2 27139080100 Minnesota Scott County None False None False \n",
"3 27139080302 Minnesota Scott County None False None False \n",
"4 27139080400 Minnesota Scott County None False None False \n",
"... ... ... ... ... ... ... ... \n",
"74129 16005001601 Idaho Bannock County None False None False \n",
"74130 16005001300 Idaho Bannock County None False None False \n",
"74131 16005001000 Idaho Bannock County None False None False \n",
"74132 16005000900 Idaho Bannock County None False None False \n",
"74133 16005000800 Idaho Bannock County None False None False \n",
"\n",
" FUDS_RAW \n",
"0 None \n",
"1 None \n",
"2 None \n",
"3 None \n",
"4 None \n",
"... ... \n",
"74129 None \n",
"74130 None \n",
"74131 None \n",
"74132 None \n",
"74133 None \n",
"\n",
"[74134 rows x 8 columns]"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind = nation[['GEOID10', 'SF', 'CF', 'HRS_ET', 'AML_ET', 'AML_RAW','FUDS_ET', 'FUDS_RAW']]\n",
"nation_new_ind"
]
},
{
"cell_type": "code",
"execution_count": 68,
"id": "0f37acf4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([None, '0', '1'], dtype=object)"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['HRS_ET'].unique()"
]
},
{
"cell_type": "code",
"execution_count": 69,
"id": "4ae865ae",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 8843\n",
"1 4045\n",
"Name: HRS_ET, dtype: int64"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['HRS_ET'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "2f0d29db",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([False, True])"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['AML_ET'].unique()"
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "646b3754",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False 72100\n",
"True 2034\n",
"Name: AML_ET, dtype: int64"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['AML_ET'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 57,
"id": "0571df6d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([None, '1'], dtype=object)"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['AML_RAW'].unique()"
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "171fa3c9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1 2034\n",
"Name: AML_RAW, dtype: int64"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['AML_RAW'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "370b0769",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([False, True])"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['FUDS_ET'].unique()"
]
},
{
"cell_type": "code",
"execution_count": 62,
"id": "f8afb668",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False 72056\n",
"True 2078\n",
"Name: FUDS_ET, dtype: int64"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['FUDS_ET'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 63,
"id": "f2e3b78a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([None, '0', '1'], dtype=object)"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['FUDS_RAW'].unique()"
]
},
{
"cell_type": "code",
"execution_count": 64,
"id": "b722e802",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 3170\n",
"1 2078\n",
"Name: FUDS_RAW, dtype: int64"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nation_new_ind['FUDS_RAW'].value_counts()"
]
}
],
"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.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}