{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Geomapping Public Comments" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Of the 3919 files sent by the DEC, we were able to map the origin of 2611 comments (66%). An anonymized dataframe as been provided, \"anon_w_locations.csv\". \n", "\n", "This csv contains:\n", "- the suject line of the email comment sent (\"subject\")\n", "- the date submitted (\"month\", \"day\", \"year\")\n", "- city (\"city)\n", "- state (\"region1\")\n", "- zipcode (\"postal_code\")\n", "- latitude (\"lat\")\n", "- longitude (\"lng\")\n", "- stance (0 = \"anti-renewal\", 1 = \"pro-renewal\")\n", "\n", "17 of the 38 pro-renewal comments have been mapped, one being Greenidge itself. 2594 of the 3872 anti-renewal comments have been mapped. There have been 14 identified from out of state, 3 of which are pro-renewal and 11 being anti-renewal." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
subjectmonthdayyearcityregion1postal_codelatlngstance
0Please Deny Title 5 Permit11.015.021.0PeekskillNew York1056641.282600-73.9241010
1Luc - Greenidge Generating Station11.019.021.0IthacaNY1485042.435835-76.4814220
2Jean - Deny Greenidge's Title V Air Permit10.09.021.0MineolaNY11501-136540.748224-73.6512640
3hua - Deny Greenidge's Title V Air Permit10.05.021.0AlbanyNY12208-101042.641204-73.8345020
4Grennidge Power Plant10.022.021.0Penn YanNY1452742.716076-77.0664211
\n", "
" ], "text/plain": [ " subject month day year city \\\n", "0 Please Deny Title 5 Permit 11.0 15.0 21.0 Peekskill \n", "1 Luc - Greenidge Generating Station 11.0 19.0 21.0 Ithaca \n", "2 Jean - Deny Greenidge's Title V Air Permit 10.0 9.0 21.0 Mineola \n", "3 hua - Deny Greenidge's Title V Air Permit 10.0 5.0 21.0 Albany \n", "4 Grennidge Power Plant 10.0 22.0 21.0 Penn Yan \n", "\n", " region1 postal_code lat lng stance \n", "0 New York 10566 41.282600 -73.924101 0 \n", "1 NY 14850 42.435835 -76.481422 0 \n", "2 NY 11501-1365 40.748224 -73.651264 0 \n", "3 NY 12208-1010 42.641204 -73.834502 0 \n", "4 NY 14527 42.716076 -77.066421 1 " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import folium\n", "import pandas as pd\n", "\n", "df = pd.read_csv(\"anon_w_locations.csv\", index_col=0)\n", "df = df.dropna()\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "Red dot - anti-renewal, Green dot - pro-renewal\n" ] }, { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(\"\\n\")\n", "print(\"Red dot - anti-renewal, Green dot - pro-renewal\")\n", "\n", "m = folium.Map(location=df[[\"lat\", \"lng\"]].mean().to_list(), zoom_start=2)\n", "\n", "markers_colors = ['red', 'green']\n", "\n", "for lat, lng, city, suject, stance in zip(df['lat'], df['lng'], df['city'], df['subject'], df['stance']):\n", " if stance == 0:\n", " stance_string = \"anti-renewal\"\n", " else:\n", " stance_string = \"pro-renewal\"\n", " folium.vector_layers.CircleMarker(\n", " [lat, lng],\n", " radius=2,\n", " color = markers_colors[stance],\n", " tooltip = str(city)+ ', '+stance_string,\n", " fill=True,\n", " fill_opacity=0.6).add_to(m)\n", "\n", "\n", "m" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }