From 1d6f06f5787bdc429612c66dabbd0bbc05a18184 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Wed, 25 Sep 2024 20:37:18 -0700 Subject: [PATCH] Update density_and_public_transportation.ipynb --- .../density_and_public_transportation.ipynb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/notebooks/density_and_public_transportation.ipynb b/docs/notebooks/density_and_public_transportation.ipynb index 3ffa1b1..170da81 100644 --- a/docs/notebooks/density_and_public_transportation.ipynb +++ b/docs/notebooks/density_and_public_transportation.ipynb @@ -245,9 +245,7 @@ "jc = JenksCaspall(\n", " zones_interpolated[\"Total Population + Worker Population Density\"].fillna(0), k=10\n", ")\n", - "colors = []\n", - "for color in jc.yb:\n", - " colors.append(Viridis_20.colors[color])\n", + "colors = numpy.array(Viridis_20.colors)[jc.yb]\n", "layer.get_fill_color = numpy.uint8(colors)\n", "\n", "Map(layers=[layer])" @@ -470,9 +468,7 @@ "jc = JenksCaspall(\n", " zones_interpolated[\"Total Population + Worker Population Density\"], k=10\n", ")\n", - "colors = []\n", - "for color in jc.yb:\n", - " colors.append(Viridis_20.colors[color])\n", + "colors = numpy.array(Viridis_20.colors)[jc.yb]\n", "layer.get_fill_color = numpy.uint8(colors)\n", "layers = [layer]\n", "for route in network.routes:\n", @@ -648,13 +644,12 @@ "outputs": [], "source": [ "from mapclassify import Quantiles\n", + "import numpy\n", "\n", "zones_interpolated[\"Accessibility w/in 15 minutes\"] = tdf.T.sum()\n", "layer = SolidPolygonLayer.from_geopandas(zones_interpolated, opacity=0.1)\n", "jc = Quantiles(zones_interpolated[\"Accessibility w/in 15 minutes\"], k=10)\n", - "colors = []\n", - "for color in jc.yb:\n", - " colors.append(Viridis_20.colors[color])\n", + "colors = numpy.array(Viridis_20.colors)[jc.yb]\n", "layer.get_fill_color = numpy.uint8(colors)\n", "layers = [layer]\n", "\n",