Skip to content

Instantly share code, notes, and snippets.

@georgesb
Last active December 15, 2023 19:50
Show Gist options
  • Save georgesb/eb9dd09f4419903137a0e5cbe476005c to your computer and use it in GitHub Desktop.
Save georgesb/eb9dd09f4419903137a0e5cbe476005c to your computer and use it in GitHub Desktop.

Revisions

  1. georgesb revised this gist Dec 15, 2023. No changes.
  2. georgesb revised this gist Dec 15, 2023. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion medianincome.ipynb
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,8 @@
    "metadata": {
    "colab": {
    "provenance": [],
    "authorship_tag": "ABX9TyP/4nnHQwKLPFGreOKx3TDu"
    "authorship_tag": "ABX9TyP/4nnHQwKLPFGreOKx3TDu",
    "include_colab_link": true
    },
    "kernelspec": {
    "name": "python3",
    @@ -15,6 +16,16 @@
    }
    },
    "cells": [
    {
    "cell_type": "markdown",
    "metadata": {
    "id": "view-in-github",
    "colab_type": "text"
    },
    "source": [
    "<a href=\"https://colab.research.google.com/gist/georgesb/eb9dd09f4419903137a0e5cbe476005c/medianincome.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 1,
  3. georgesb created this gist Dec 15, 2023.
    519 changes: 519 additions & 0 deletions medianincome.ipynb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,519 @@
    {
    "nbformat": 4,
    "nbformat_minor": 0,
    "metadata": {
    "colab": {
    "provenance": [],
    "authorship_tag": "ABX9TyP/4nnHQwKLPFGreOKx3TDu"
    },
    "kernelspec": {
    "name": "python3",
    "display_name": "Python 3"
    },
    "language_info": {
    "name": "python"
    }
    },
    "cells": [
    {
    "cell_type": "code",
    "execution_count": 1,
    "metadata": {
    "colab": {
    "base_uri": "https://localhost:8080/",
    "height": 592
    },
    "id": "TAJ7FCrT-nyT",
    "outputId": "975c6099-3b23-4ddd-adab-ce4fdfe6247b"
    },
    "outputs": [
    {
    "output_type": "execute_result",
    "data": {
    "text/plain": [
    "<folium.folium.Map at 0x7aa8d54f7760>"
    ],
    "text/html": [
    "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
    "&lt;html&gt;\n",
    "&lt;head&gt;\n",
    " \n",
    " &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
    " \n",
    " &lt;script&gt;\n",
    " L_NO_TOUCH = false;\n",
    " L_DISABLE_3D = false;\n",
    " &lt;/script&gt;\n",
    " \n",
    " &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
    " &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
    " &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
    " &lt;script src=&quot;https://code.jquery.com/jquery-1.12.4.min.js&quot;&gt;&lt;/script&gt;\n",
    " &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
    " &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
    " &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css&quot;/&gt;\n",
    " &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css&quot;/&gt;\n",
    " &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css&quot;/&gt;\n",
    " &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css&quot;/&gt;\n",
    " &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
    " &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
    " \n",
    " &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
    " initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
    " &lt;style&gt;\n",
    " #map_4c77671e29448fd2f401b34d4ce4f78c {\n",
    " position: relative;\n",
    " width: 100.0%;\n",
    " height: 100.0%;\n",
    " left: 0.0%;\n",
    " top: 0.0%;\n",
    " }\n",
    " .leaflet-container { font-size: 1rem; }\n",
    " &lt;/style&gt;\n",
    " \n",
    "&lt;/head&gt;\n",
    "&lt;body&gt;\n",
    " \n",
    " \n",
    " &lt;div class=&quot;folium-map&quot; id=&quot;map_4c77671e29448fd2f401b34d4ce4f78c&quot; &gt;&lt;/div&gt;\n",
    " \n",
    "&lt;/body&gt;\n",
    "&lt;script&gt;\n",
    " \n",
    " \n",
    " var map_4c77671e29448fd2f401b34d4ce4f78c = L.map(\n",
    " &quot;map_4c77671e29448fd2f401b34d4ce4f78c&quot;,\n",
    " {\n",
    " center: [37.0902, -95.7129],\n",
    " crs: L.CRS.EPSG3857,\n",
    " zoom: 4.5,\n",
    " zoomControl: true,\n",
    " preferCanvas: false,\n",
    " }\n",
    " );\n",
    "\n",
    " \n",
    "\n",
    " \n",
    " \n",
    " var tile_layer_4dbc8e503906ecb8f46eddb640fc82e1 = L.tileLayer(\n",
    " &quot;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
    " {&quot;attribution&quot;: &quot;Data by \\u0026copy; \\u003ca target=\\&quot;_blank\\&quot; href=\\&quot;http://openstreetmap.org\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca target=\\&quot;_blank\\&quot; href=\\&quot;http://www.openstreetmap.org/copyright\\&quot;\\u003eODbL\\u003c/a\\u003e.&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 18, &quot;maxZoom&quot;: 18, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var marker_4a19e69bdb6c97aed1d4af7e185bd38d = L.marker(\n",
    " [36.17, -119.7462],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_1970e4f324422f782f9d130ec3cc2e03 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_4a19e69bdb6c97aed1d4af7e185bd38d.setIcon(icon_1970e4f324422f782f9d130ec3cc2e03);\n",
    " \n",
    " \n",
    " var popup_26c38ad1099564b9a269cbf620eb69dd = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_4fb3b3d6444c0e395f449624e0a740ed = $(`&lt;div id=&quot;html_4fb3b3d6444c0e395f449624e0a740ed&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;California $80,423&lt;/div&gt;`)[0];\n",
    " popup_26c38ad1099564b9a269cbf620eb69dd.setContent(html_4fb3b3d6444c0e395f449624e0a740ed);\n",
    " \n",
    " \n",
    "\n",
    " marker_4a19e69bdb6c97aed1d4af7e185bd38d.bindPopup(popup_26c38ad1099564b9a269cbf620eb69dd)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_74acf4c832d30cfee401bca2e3645c6d = L.marker(\n",
    " [42.1497, -74.9384],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_e8fd03c87c91142907c49fc9d80bd2e6 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_74acf4c832d30cfee401bca2e3645c6d.setIcon(icon_e8fd03c87c91142907c49fc9d80bd2e6);\n",
    " \n",
    " \n",
    " var popup_e82c3c83a919c089654ac27e726f14bc = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_582acb4778e2e6ac45e9b070e71954d2 = $(`&lt;div id=&quot;html_582acb4778e2e6ac45e9b070e71954d2&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;New York $72,038&lt;/div&gt;`)[0];\n",
    " popup_e82c3c83a919c089654ac27e726f14bc.setContent(html_582acb4778e2e6ac45e9b070e71954d2);\n",
    " \n",
    " \n",
    "\n",
    " marker_74acf4c832d30cfee401bca2e3645c6d.bindPopup(popup_e82c3c83a919c089654ac27e726f14bc)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_0d6744f0f0db00cf8127afc1edef890b = L.marker(\n",
    " [40.3363, -89.0022],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_4741c86834e1026eb3ba9c9a02d85b53 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_0d6744f0f0db00cf8127afc1edef890b.setIcon(icon_4741c86834e1026eb3ba9c9a02d85b53);\n",
    " \n",
    " \n",
    " var popup_005d6b629894c4daba971aaedc9cf6b8 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_03f0bdbe9c9523395c56644b0fde8ac3 = $(`&lt;div id=&quot;html_03f0bdbe9c9523395c56644b0fde8ac3&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Illinois $69,212&lt;/div&gt;`)[0];\n",
    " popup_005d6b629894c4daba971aaedc9cf6b8.setContent(html_03f0bdbe9c9523395c56644b0fde8ac3);\n",
    " \n",
    " \n",
    "\n",
    " marker_0d6744f0f0db00cf8127afc1edef890b.bindPopup(popup_005d6b629894c4daba971aaedc9cf6b8)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_f0038adf5597505016d2b0c6197baea8 = L.marker(\n",
    " [31.106, -97.6475],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_101c63b0a6c253e2598fcb9698fc1f3d = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_f0038adf5597505016d2b0c6197baea8.setIcon(icon_101c63b0a6c253e2598fcb9698fc1f3d);\n",
    " \n",
    " \n",
    " var popup_a86bbc5903dd61c949e72884b2afd57f = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_7f3038f05349171369129bea39ad92f7 = $(`&lt;div id=&quot;html_7f3038f05349171369129bea39ad92f7&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Texas $64,044&lt;/div&gt;`)[0];\n",
    " popup_a86bbc5903dd61c949e72884b2afd57f.setContent(html_7f3038f05349171369129bea39ad92f7);\n",
    " \n",
    " \n",
    "\n",
    " marker_f0038adf5597505016d2b0c6197baea8.bindPopup(popup_a86bbc5903dd61c949e72884b2afd57f)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_73f45a4d69728d5409f189cb4b9a1a6f = L.marker(\n",
    " [47.3917, -121.5708],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_7c80f3e496653e8e0bb11e40b594d995 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_73f45a4d69728d5409f189cb4b9a1a6f.setIcon(icon_7c80f3e496653e8e0bb11e40b594d995);\n",
    " \n",
    " \n",
    " var popup_d9e6113cba41fc4d195f24cc6817c514 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_af49b6016f60002526f54824b6027685 = $(`&lt;div id=&quot;html_af49b6016f60002526f54824b6027685&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Washington $78,674&lt;/div&gt;`)[0];\n",
    " popup_d9e6113cba41fc4d195f24cc6817c514.setContent(html_af49b6016f60002526f54824b6027685);\n",
    " \n",
    " \n",
    "\n",
    " marker_73f45a4d69728d5409f189cb4b9a1a6f.bindPopup(popup_d9e6113cba41fc4d195f24cc6817c514)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_b0384fc8f829174a49f19bb4acf72c6c = L.marker(\n",
    " [42.0046, -93.214],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_bbe83208f2d8f6b0d4a8537388835892 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_b0384fc8f829174a49f19bb4acf72c6c.setIcon(icon_bbe83208f2d8f6b0d4a8537388835892);\n",
    " \n",
    " \n",
    " var popup_268e735b9f3238eb818aa2ba18a3d7a5 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_d985ef38486ad75623088dbd022a5efe = $(`&lt;div id=&quot;html_d985ef38486ad75623088dbd022a5efe&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Iowa $61,807&lt;/div&gt;`)[0];\n",
    " popup_268e735b9f3238eb818aa2ba18a3d7a5.setContent(html_d985ef38486ad75623088dbd022a5efe);\n",
    " \n",
    " \n",
    "\n",
    " marker_b0384fc8f829174a49f19bb4acf72c6c.bindPopup(popup_268e735b9f3238eb818aa2ba18a3d7a5)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_ed01dbfec40159c9de15688c3cfaee64 = L.marker(\n",
    " [27.8333, -81.717],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_4cf697b06ec13bbf838f300bf0443553 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_ed01dbfec40159c9de15688c3cfaee64.setIcon(icon_4cf697b06ec13bbf838f300bf0443553);\n",
    " \n",
    " \n",
    " var popup_41d402292cb4a55bf63c013953ed02bf = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_de6ad31826f4cae46d43420a1d6afc6f = $(`&lt;div id=&quot;html_de6ad31826f4cae46d43420a1d6afc6f&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Florida $90,395&lt;/div&gt;`)[0];\n",
    " popup_41d402292cb4a55bf63c013953ed02bf.setContent(html_de6ad31826f4cae46d43420a1d6afc6f);\n",
    " \n",
    " \n",
    "\n",
    " marker_ed01dbfec40159c9de15688c3cfaee64.bindPopup(popup_41d402292cb4a55bf63c013953ed02bf)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_3c5be3b0bc69248aca0748d55880e54a = L.marker(\n",
    " [38.4199, -117.1219],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_50d245c8790e8ae2e35a9d6aee344f52 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_3c5be3b0bc69248aca0748d55880e54a.setIcon(icon_50d245c8790e8ae2e35a9d6aee344f52);\n",
    " \n",
    " \n",
    " var popup_5ba68eb29c3046d6f4200f93135b5c4f = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_ddb750d3b287f8af627e8826e799bdee = $(`&lt;div id=&quot;html_ddb750d3b287f8af627e8826e799bdee&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Nevada $63,268&lt;/div&gt;`)[0];\n",
    " popup_5ba68eb29c3046d6f4200f93135b5c4f.setContent(html_ddb750d3b287f8af627e8826e799bdee);\n",
    " \n",
    " \n",
    "\n",
    " marker_3c5be3b0bc69248aca0748d55880e54a.bindPopup(popup_5ba68eb29c3046d6f4200f93135b5c4f)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_7f750be5ca313b7e9944ad7c231fa717 = L.marker(\n",
    " [32.7673, -89.6812],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_2cc28e1280730f4d04f0ce537055040a = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_7f750be5ca313b7e9944ad7c231fa717.setIcon(icon_2cc28e1280730f4d04f0ce537055040a);\n",
    " \n",
    " \n",
    " var popup_515f7dc4194ea4a6f65d99797094482f = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_b386e1c92e07a4f82841813e1f3ffab3 = $(`&lt;div id=&quot;html_b386e1c92e07a4f82841813e1f3ffab3&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Mississippi $45,928&lt;/div&gt;`)[0];\n",
    " popup_515f7dc4194ea4a6f65d99797094482f.setContent(html_b386e1c92e07a4f82841813e1f3ffab3);\n",
    " \n",
    " \n",
    "\n",
    " marker_7f750be5ca313b7e9944ad7c231fa717.bindPopup(popup_515f7dc4194ea4a6f65d99797094482f)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_a1cd93ff3dfaca60623fea8d99cee280 = L.marker(\n",
    " [32.9866, -83.6487],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_2e3b8313f7241b787e8ebc54971c6dac = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_a1cd93ff3dfaca60623fea8d99cee280.setIcon(icon_2e3b8313f7241b787e8ebc54971c6dac);\n",
    " \n",
    " \n",
    " var popup_2dc15c0118f35a402e327f857d2e92fe = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_8d18737772045b39ff64e3aa7d640e3b = $(`&lt;div id=&quot;html_8d18737772045b39ff64e3aa7d640e3b&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Georgia $42,518&lt;/div&gt;`)[0];\n",
    " popup_2dc15c0118f35a402e327f857d2e92fe.setContent(html_8d18737772045b39ff64e3aa7d640e3b);\n",
    " \n",
    " \n",
    "\n",
    " marker_a1cd93ff3dfaca60623fea8d99cee280.bindPopup(popup_2dc15c0118f35a402e327f857d2e92fe)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_12469bba8f6844a524a16f98e6d5ba02 = L.marker(\n",
    " [41.1289, -98.2883],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_8409d82fd8c326bcc5019ee19fa91ec4 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_12469bba8f6844a524a16f98e6d5ba02.setIcon(icon_8409d82fd8c326bcc5019ee19fa91ec4);\n",
    " \n",
    " \n",
    " var popup_03abaa73c342afe46f388c221446cd26 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_4d93a7212b3d7930b6eeb1bc4ad100f8 = $(`&lt;div id=&quot;html_4d93a7212b3d7930b6eeb1bc4ad100f8&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Nebraska $63,290&lt;/div&gt;`)[0];\n",
    " popup_03abaa73c342afe46f388c221446cd26.setContent(html_4d93a7212b3d7930b6eeb1bc4ad100f8);\n",
    " \n",
    " \n",
    "\n",
    " marker_12469bba8f6844a524a16f98e6d5ba02.bindPopup(popup_03abaa73c342afe46f388c221446cd26)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_ddfdeec37c35ee319eafe849af25a549 = L.marker(\n",
    " [39.0646, -105.3272],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_880dd7f47d73385fe637487a98ebdaa2 = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_ddfdeec37c35ee319eafe849af25a549.setIcon(icon_880dd7f47d73385fe637487a98ebdaa2);\n",
    " \n",
    " \n",
    " var popup_81d14957c88c677418841818477a976b = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_36d4627f50596da07b0bff19ae7a041f = $(`&lt;div id=&quot;html_36d4627f50596da07b0bff19ae7a041f&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Colorado $77,104&lt;/div&gt;`)[0];\n",
    " popup_81d14957c88c677418841818477a976b.setContent(html_36d4627f50596da07b0bff19ae7a041f);\n",
    " \n",
    " \n",
    "\n",
    " marker_ddfdeec37c35ee319eafe849af25a549.bindPopup(popup_81d14957c88c677418841818477a976b)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    " \n",
    " var marker_3a9fd12d5f879a8356e145da12d0d334 = L.marker(\n",
    " [42.2373, -71.5314],\n",
    " {}\n",
    " ).addTo(map_4c77671e29448fd2f401b34d4ce4f78c);\n",
    " \n",
    " \n",
    " var icon_ec238cf260781d8dc896de93530dccbe = L.AwesomeMarkers.icon(\n",
    " {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;info-sign&quot;, &quot;iconColor&quot;: &quot;white&quot;, &quot;markerColor&quot;: &quot;blue&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
    " );\n",
    " marker_3a9fd12d5f879a8356e145da12d0d334.setIcon(icon_ec238cf260781d8dc896de93530dccbe);\n",
    " \n",
    " \n",
    " var popup_e0086b36f0c04b8a6bee9892b477d9d1 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
    "\n",
    " \n",
    " \n",
    " var html_7e80a644618a9ec5f37a29753b114437 = $(`&lt;div id=&quot;html_7e80a644618a9ec5f37a29753b114437&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Massachusetts $85,700&lt;/div&gt;`)[0];\n",
    " popup_e0086b36f0c04b8a6bee9892b477d9d1.setContent(html_7e80a644618a9ec5f37a29753b114437);\n",
    " \n",
    " \n",
    "\n",
    " marker_3a9fd12d5f879a8356e145da12d0d334.bindPopup(popup_e0086b36f0c04b8a6bee9892b477d9d1)\n",
    " ;\n",
    "\n",
    " \n",
    " \n",
    "&lt;/script&gt;\n",
    "&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
    ]
    },
    "metadata": {},
    "execution_count": 1
    }
    ],
    "source": [
    "import folium\n",
    "import pandas as pd\n",
    "\n",
    "# list of states - add or remove\n",
    "list = [\"California\",\"New York\",\"Illinois\",\"Texas\",\"Washington\",\"Iowa\",\n",
    " \"Florida\",\"Nevada\",\"Mississippi\",\"Georgia\",\"Nebraska\",\"Colorado\",\n",
    " \"Massachusetts\"]\n",
    "\n",
    "# set criteria from census data column headings\n",
    "criteria = \"Estimate of median household income 2019\"\n",
    "dollarSign = \"$\"\n",
    "percent = \"\"\n",
    "\n",
    "# United States lat and long\n",
    "latitude = 37.0902\n",
    "longitude = -95.7129\n",
    "\n",
    "# Create folium map\n",
    "my_map = folium.Map(location=[latitude, longitude], zoom_start=4.5)\n",
    "\n",
    "# get json file of all states latitude and longitude\n",
    "url = \"https://raw.githubusercontent.com/georgesb/files/main/states.json\"\n",
    "df = pd.read_json(url)\n",
    "\n",
    "# get CensusData.csv file\n",
    "url = \"https://raw.githubusercontent.com/georgesb/files/main/CensusData.csv\"\n",
    "censusData = pd.read_csv(url)\n",
    "\n",
    "# functions\n",
    "def setLatitude(state):\n",
    " return float(df.loc[df[\"state\"] == state, \"latitude\"])\n",
    "\n",
    "def setLongitude(state):\n",
    " return float(df.loc[df[\"state\"] == state, \"longitude\"])\n",
    "\n",
    "def setMarker(state):\n",
    " latitude = setLatitude(state)\n",
    " longitude = setLongitude(state)\n",
    " searchResults = str(*censusData.loc[censusData[\"Area Name\"]==state,criteria])\n",
    " folium.Marker(\n",
    " location=[latitude, longitude],\n",
    " popup=state + \" \" + dollarSign + searchResults + percent,\n",
    " icon=folium.Icon(color=\"blue\", icon=\"info-sign\"),\n",
    ").add_to(my_map)\n",
    "# end function section\n",
    "\n",
    "# loop to set markers for each state in list\n",
    "for marker in list:\n",
    " setMarker(marker)\n",
    "\n",
    "# Load the map\n",
    "my_map\n"
    ]
    }
    ]
    }