Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#54)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](pre-commit/pre-commit-hooks@v4.5.0...v4.6.0)
- [github.com/astral-sh/ruff-pre-commit: v0.3.3 → v0.4.1](astral-sh/ruff-pre-commit@v0.3.3...v0.4.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Apr 29, 2024
1 parent 0a8de2b commit 63dd703
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down Expand Up @@ -30,7 +30,7 @@ repos:
name: codespell
description: Checks for common misspellings in text files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
rev: v0.4.1
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand Down
15 changes: 12 additions & 3 deletions notebooks/sample-indicators/housing-and-community.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7867,7 +7867,9 @@
},
"outputs": [],
"source": [
"left = POI[POI[\"_upd10max\"] >= 0.5].value_counts([\"ADM2_EN\", \"type\"]).to_frame(\"damaged\")\n",
"left = (\n",
" POI[POI[\"_upd10max\"] >= 0.5].value_counts([\"ADM2_EN\", \"type\"]).to_frame(\"damaged\")\n",
")\n",
"right = POI.value_counts([\"ADM2_EN\", \"type\"]).to_frame(\"total\")\n",
"\n",
"df = pd.merge(left, right, on=[\"ADM2_EN\", \"type\"]).reset_index()\n",
Expand Down Expand Up @@ -14214,8 +14216,15 @@
},
"outputs": [],
"source": [
"ntl = pd.read_csv(\"../../data/ntl/PSE_2-buildings_without_electricity.csv\", index_col=\"name\")[['% residential buildings without electricity']]\n",
"ntl.rename(columns = {'% residential buildings without electricity':'% Residential Buildings without Observed Nighttime Lights'}, inplace=True)"
"ntl = pd.read_csv(\n",
" \"../../data/ntl/PSE_2-buildings_without_electricity.csv\", index_col=\"name\"\n",
")[[\"% residential buildings without electricity\"]]\n",
"ntl.rename(\n",
" columns={\n",
" \"% residential buildings without electricity\": \"% Residential Buildings without Observed Nighttime Lights\"\n",
" },\n",
" inplace=True,\n",
")"
]
},
{
Expand Down
41 changes: 31 additions & 10 deletions notebooks/sample-indicators/industry-and-commerce.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4953,7 +4953,9 @@
},
"outputs": [],
"source": [
"left = POI[POI[\"_upd10max\"] >= 0.5].value_counts([\"ADM2_EN\", \"type\"]).to_frame(\"damaged\")\n",
"left = (\n",
" POI[POI[\"_upd10max\"] >= 0.5].value_counts([\"ADM2_EN\", \"type\"]).to_frame(\"damaged\")\n",
")\n",
"right = POI.value_counts([\"ADM2_EN\", \"type\"]).to_frame(\"total\")\n",
"\n",
"df = pd.merge(left, right, on=[\"ADM2_EN\", \"type\"]).reset_index()\n",
Expand Down Expand Up @@ -9320,12 +9322,25 @@
},
"outputs": [],
"source": [
"ntl = pd.read_csv(\"../../data/ntl/PSE_2-buildings_without_electricity.csv\", index_col=\"name\")[['% industrial buildings without electricity', '% commercial buildings without electricity']]\n",
"ntl.rename(columns = {'% industrial buildings without electricity':'industrial', '% commercial buildings without electricity':'commercial'}, inplace=True)\n",
"ntl = pd.read_csv(\n",
" \"../../data/ntl/PSE_2-buildings_without_electricity.csv\", index_col=\"name\"\n",
")[\n",
" [\n",
" \"% industrial buildings without electricity\",\n",
" \"% commercial buildings without electricity\",\n",
" ]\n",
"]\n",
"ntl.rename(\n",
" columns={\n",
" \"% industrial buildings without electricity\": \"industrial\",\n",
" \"% commercial buildings without electricity\": \"commercial\",\n",
" },\n",
" inplace=True,\n",
")\n",
"\n",
"ntl = ntl.reset_index()\n",
"ntl.rename(columns = {'name':'ADM2_EN'}, inplace=True)\n",
"ntl.set_index('ADM2_EN', inplace=True)"
"ntl.rename(columns={\"name\": \"ADM2_EN\"}, inplace=True)\n",
"ntl.set_index(\"ADM2_EN\", inplace=True)"
]
},
{
Expand Down Expand Up @@ -9417,7 +9432,7 @@
"outputs": [],
"source": [
"ROADS = geopandas.read_file(\n",
" \"../../data/damage_assessment/delivery10_10Apr2024_2.5sigma/vectors/damaged_roads_lines_10Apr2024_2_5sigma.shp\"\n",
" \"../../data/damage_assessment/delivery10_10Apr2024_2.5sigma/vectors/damaged_roads_lines_10Apr2024_2_5sigma.shp\"\n",
").to_crs(\"EPSG:4326\")\n",
"\n",
"ROADS = geopandas.sjoin(ROADS, GAZA)\n",
Expand Down Expand Up @@ -11371,9 +11386,9 @@
")\n",
"\n",
"absolute_damage_numbers = list(\n",
" primary_secondary_roads.pivot_table(\"damaged\", \"ADM2_EN\", observed=False).sort_values(\n",
" by=\"ADM2_EN\", ascending=False\n",
" )[\"damaged\"]\n",
" primary_secondary_roads.pivot_table(\n",
" \"damaged\", \"ADM2_EN\", observed=False\n",
" ).sort_values(by=\"ADM2_EN\", ascending=False)[\"damaged\"]\n",
")\n",
"\n",
"\n",
Expand Down Expand Up @@ -11498,7 +11513,13 @@
" },\n",
" inplace=True,\n",
")\n",
"ROADS.rename(columns = {'damaged':'Primary and Secondary Damaged Roads (in km)', 'perc':'% Primary and Secondary Roads Damaged'}, inplace=True)"
"ROADS.rename(\n",
" columns={\n",
" \"damaged\": \"Primary and Secondary Damaged Roads (in km)\",\n",
" \"perc\": \"% Primary and Secondary Roads Damaged\",\n",
" },\n",
" inplace=True,\n",
")"
]
},
{
Expand Down

0 comments on commit 63dd703

Please sign in to comment.