mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-07 21:14:18 -07:00
Issue 105: Configure and run black
and other pre-commit hooks (clean branch) (#1962)
* Configure and run `black` and other pre-commit hooks Co-authored-by: matt bowen <matthew.r.bowen@omb.eop.gov>
This commit is contained in:
parent
baa34ec038
commit
6e6223cd5e
162 changed files with 716 additions and 602 deletions
|
@ -211,7 +211,9 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"tmp = sns.FacetGrid(data=score_m, col=\"Urban Heuristic Flag\", col_wrap=2, height=7)\n",
|
||||
"tmp = sns.FacetGrid(\n",
|
||||
" data=score_m, col=\"Urban Heuristic Flag\", col_wrap=2, height=7\n",
|
||||
")\n",
|
||||
"tmp.map(\n",
|
||||
" sns.distplot,\n",
|
||||
" \"Expected agricultural loss rate (Natural Hazards Risk Index) (percentile)\",\n",
|
||||
|
@ -250,7 +252,9 @@
|
|||
")\n",
|
||||
"\n",
|
||||
"nri_with_flag[\"total_ag_loss\"] = nri_with_flag.filter(like=\"EALA\").sum(axis=1)\n",
|
||||
"nri_with_flag[\"total_ag_loss_pctile\"] = nri_with_flag[\"total_ag_loss\"].rank(pct=True)\n",
|
||||
"nri_with_flag[\"total_ag_loss_pctile\"] = nri_with_flag[\"total_ag_loss\"].rank(\n",
|
||||
" pct=True\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"nri_with_flag.groupby(\"Urban Heuristic Flag\")[\"total_ag_loss_pctile\"].mean()"
|
||||
]
|
||||
|
@ -779,9 +783,9 @@
|
|||
" \"Greater than or equal to the 90th percentile for expected agriculture loss rate, is low income, and has a low percent of higher ed students?\"\n",
|
||||
"].astype(int)\n",
|
||||
"\n",
|
||||
"score_m_adjusted_tracts = set(score_m[score_m[\"adjusted\"] > 0][\"GEOID10_TRACT\"]).union(\n",
|
||||
" all_ag_loss_tracts\n",
|
||||
")\n",
|
||||
"score_m_adjusted_tracts = set(\n",
|
||||
" score_m[score_m[\"adjusted\"] > 0][\"GEOID10_TRACT\"]\n",
|
||||
").union(all_ag_loss_tracts)\n",
|
||||
"display(len(set(all_scorem_tracts).difference(score_m_adjusted_tracts)))"
|
||||
]
|
||||
},
|
||||
|
@ -832,7 +836,11 @@
|
|||
" left_clip = nri_with_flag[nri_with_flag[\"Urban Heuristic Flag\"] == 0][\n",
|
||||
" \"AGRIVALUE\"\n",
|
||||
" ].quantile(threshold)\n",
|
||||
" print(\"At threshold {:.2f}, minimum value is ${:,.0f}\".format(threshold, left_clip))\n",
|
||||
" print(\n",
|
||||
" \"At threshold {:.2f}, minimum value is ${:,.0f}\".format(\n",
|
||||
" threshold, left_clip\n",
|
||||
" )\n",
|
||||
" )\n",
|
||||
" tmp_value = nri_with_flag[\"AGRIVALUE\"].clip(lower=left_clip)\n",
|
||||
" nri_with_flag[\"total_ag_loss_pctile_{:.2f}\".format(threshold)] = (\n",
|
||||
" nri_with_flag[\"total_ag_loss\"] / tmp_value\n",
|
||||
|
@ -889,7 +897,9 @@
|
|||
" .set_index(\"Left clip value\")[[\"Rural\", \"Urban\"]]\n",
|
||||
" .stack()\n",
|
||||
" .reset_index()\n",
|
||||
" .rename(columns={\"level_1\": \"Tract classification\", 0: \"Average percentile\"})\n",
|
||||
" .rename(\n",
|
||||
" columns={\"level_1\": \"Tract classification\", 0: \"Average percentile\"}\n",
|
||||
" )\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue