diff --git a/.hintrc b/.hintrc new file mode 100644 index 00000000..9024f9c7 --- /dev/null +++ b/.hintrc @@ -0,0 +1,13 @@ +{ + "extends": [ + "development" + ], + "hints": { + "axe/name-role-value": [ + "default", + { + "button-name": "off" + } + ] + } +} \ No newline at end of file diff --git a/Delhi_Metro.ipynb b/Delhi_Metro.ipynb new file mode 100644 index 00000000..a61b3ae4 --- /dev/null +++ b/Delhi_Metro.ipynb @@ -0,0 +1,14404 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyNr8RB70Hu4nOgidFAo2esK", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "source": [ + "import pandas as pd\n", + "import folium\n", + "import plotly.express as px\n", + "import plotly.graph_objects as go\n", + "from plotly.subplots import make_subplots\n", + "import plotly.io as pio\n", + "pio.templates.default = \"plotly_white\"\n", + "\n", + "metro_data = pd.read_csv(\"/content/Delhi-Metro-Network.csv\")\n", + "\n", + "print(metro_data.head())" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "uLthPJW3D-DH", + "outputId": "ed2dce83-6088-4c27-a139-fd45206daff8" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " Station ID Station Name Distance from Start (km) Line \\\n", + "0 1 Jhil Mil 10.3 Red line \n", + "1 2 Welcome [Conn: Red] 46.8 Pink line \n", + "2 3 DLF Phase 3 10.0 Rapid Metro \n", + "3 4 Okhla NSIC 23.8 Magenta line \n", + "4 5 Dwarka Mor 10.2 Blue line \n", + "\n", + " Opening Date Station Layout Latitude Longitude \n", + "0 2008-04-06 Elevated 28.675790 77.312390 \n", + "1 2018-10-31 Elevated 28.671800 77.277560 \n", + "2 2013-11-14 Elevated 28.493600 77.093500 \n", + "3 2017-12-25 Elevated 28.554483 77.264849 \n", + "4 2005-12-30 Elevated 28.619320 77.033260 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# checking for missing values\n", + "missing_values = metro_data.isnull().sum()\n", + "\n", + "# checking data types\n", + "data_types = metro_data.dtypes\n", + "\n", + "missing_values" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 335 + }, + "id": "1U0uNycMETZw", + "outputId": "cc750de1-bcfd-41e7-f361-024a163c958c" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Station ID 0\n", + "Station Name 0\n", + "Distance from Start (km) 0\n", + "Line 0\n", + "Opening Date 0\n", + "Station Layout 0\n", + "Latitude 0\n", + "Longitude 0\n", + "dtype: int64" + ], + "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", + "
0
Station ID0
Station Name0
Distance from Start (km)0
Line0
Opening Date0
Station Layout0
Latitude0
Longitude0
\n", + "

" + ] + }, + "metadata": {}, + "execution_count": 8 + } + ] + }, + { + "cell_type": "code", + "source": [ + "data_types" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 335 + }, + "id": "CERyiHPZEZRg", + "outputId": "120b7b66-3a34-4663-dbcc-3892fc28f563" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Station ID int64\n", + "Station Name object\n", + "Distance from Start (km) float64\n", + "Line object\n", + "Opening Date object\n", + "Station Layout object\n", + "Latitude float64\n", + "Longitude float64\n", + "dtype: object" + ], + "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", + "
0
Station IDint64
Station Nameobject
Distance from Start (km)float64
Lineobject
Opening Dateobject
Station Layoutobject
Latitudefloat64
Longitudefloat64
\n", + "

" + ] + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "# converting 'Opening Date' to datetime format\n", + "metro_data['Opening Date'] = pd.to_datetime(metro_data['Opening Date'])" + ], + "metadata": { + "id": "O7yOqIDOEb-K" + }, + "execution_count": 10, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "# defining a color scheme for the metro lines\n", + "line_colors = {\n", + " 'Red line': 'red',\n", + " 'Blue line': 'blue',\n", + " 'Yellow line': 'beige',\n", + " 'Green line': 'green',\n", + " 'Voilet line': 'purple',\n", + " 'Pink line': 'pink',\n", + " 'Magenta line': 'darkred',\n", + " 'Orange line': 'orange',\n", + " 'Rapid Metro': 'cadetblue',\n", + " 'Aqua line': 'black',\n", + " 'Green line branch': 'lightgreen',\n", + " 'Blue line branch': 'lightblue',\n", + " 'Gray line': 'lightgray'\n", + "}\n", + "\n", + "delhi_map_with_line_tooltip = folium.Map(location=[28.7041, 77.1025], zoom_start=11)\n", + "\n", + "# adding colored markers for each metro station with line name in tooltip\n", + "for index, row in metro_data.iterrows():\n", + " line = row['Line']\n", + " color = line_colors.get(line, 'black') # Default color is black if line not found in the dictionary\n", + " folium.Marker(\n", + " location=[row['Latitude'], row['Longitude']],\n", + " popup=f\"{row['Station Name']}\",\n", + " tooltip=f\"{row['Station Name']}, {line}\",\n", + " icon=folium.Icon(color=color)\n", + " ).add_to(delhi_map_with_line_tooltip)\n", + "\n", + "# Displaying the updated map\n", + "delhi_map_with_line_tooltip" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 865 + }, + "id": "GWufmFWzEg5Q", + "outputId": "d0b8648a-9c00-46ff-e935-3efe1d98912c" + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ] + }, + "metadata": {}, + "execution_count": 11 + } + ] + }, + { + "cell_type": "code", + "source": [ + "metro_data['Opening Year'] = metro_data['Opening Date'].dt.year\n", + "\n", + "# counting the number of stations opened each year\n", + "stations_per_year = metro_data['Opening Year'].value_counts().sort_index()\n", + "\n", + "stations_per_year_df = stations_per_year.reset_index()\n", + "stations_per_year_df.columns = ['Year', 'Number of Stations']\n", + "\n", + "fig = px.bar(stations_per_year_df, x='Year', y='Number of Stations',\n", + " title=\"Number of Metro Stations Opened Each Year in Delhi\",\n", + " labels={'Year': 'Year', 'Number of Stations': 'Number of Stations Opened'})\n", + "\n", + "fig.update_layout(xaxis_tickangle=-45, xaxis=dict(tickmode='linear'),\n", + " yaxis=dict(title='Number of Stations Opened'),\n", + " xaxis_title=\"Year\")\n", + "\n", + "fig.show()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 542 + }, + "id": "Fw8IU_OlEqCQ", + "outputId": "6a14940e-106e-4979-8fb5-c56f19fafe32" + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "\n", + "" + ] + }, + "metadata": {} + } + ] + }, + { + "cell_type": "code", + "source": [ + "stations_per_line = metro_data['Line'].value_counts()\n", + "\n", + "# calculating the total distance of each metro line (max distance from start)\n", + "total_distance_per_line = metro_data.groupby('Line')['Distance from Start (km)'].max()\n", + "\n", + "avg_distance_per_line = total_distance_per_line / (stations_per_line - 1)\n", + "\n", + "line_analysis = pd.DataFrame({\n", + " 'Line': stations_per_line.index,\n", + " 'Number of Stations': stations_per_line.values,\n", + " 'Average Distance Between Stations (km)': avg_distance_per_line\n", + "})\n", + "\n", + "# sorting the DataFrame by the number of stations\n", + "line_analysis = line_analysis.sort_values(by='Number of Stations', ascending=False)\n", + "\n", + "line_analysis.reset_index(drop=True, inplace=True)\n", + "print(line_analysis)" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xwfN6jz1EywS", + "outputId": "0f0220fb-3f4a-400b-aef4-7ed0604a184d" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " Line Number of Stations \\\n", + "0 Blue line 49 \n", + "1 Pink line 38 \n", + "2 Yellow line 37 \n", + "3 Voilet line 34 \n", + "4 Red line 29 \n", + "5 Magenta line 25 \n", + "6 Aqua line 21 \n", + "7 Green line 21 \n", + "8 Rapid Metro 11 \n", + "9 Blue line branch 8 \n", + "10 Orange line 6 \n", + "11 Gray line 3 \n", + "12 Green line branch 3 \n", + "\n", + " Average Distance Between Stations (km) \n", + "0 1.355000 \n", + "1 1.097917 \n", + "2 1.157143 \n", + "3 1.950000 \n", + "4 1.240000 \n", + "5 1.050000 \n", + "6 1.379167 \n", + "7 4.160000 \n", + "8 1.421622 \n", + "9 1.000000 \n", + "10 1.167857 \n", + "11 1.318182 \n", + "12 1.269444 \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "# creating subplots\n", + "fig = make_subplots(rows=1, cols=2, subplot_titles=('Number of Stations Per Metro Line',\n", + " 'Average Distance Between Stations Per Metro Line'),\n", + " horizontal_spacing=0.2)\n", + "\n", + "# plot for Number of Stations per Line\n", + "fig.add_trace(\n", + " go.Bar(y=line_analysis['Line'], x=line_analysis['Number of Stations'],\n", + " orientation='h', name='Number of Stations', marker_color='crimson'),\n", + " row=1, col=1\n", + ")\n", + "\n", + "# plot for Average Distance Between Stations\n", + "fig.add_trace(\n", + " go.Bar(y=line_analysis['Line'], x=line_analysis['Average Distance Between Stations (km)'],\n", + " orientation='h', name='Average Distance (km)', marker_color='navy'),\n", + " row=1, col=2\n", + ")\n", + "\n", + "# update xaxis properties\n", + "fig.update_xaxes(title_text=\"Number of Stations\", row=1, col=1)\n", + "fig.update_xaxes(title_text=\"Average Distance Between Stations (km)\", row=1, col=2)\n", + "\n", + "# update yaxis properties\n", + "fig.update_yaxes(title_text=\"Metro Line\", row=1, col=1)\n", + "fig.update_yaxes(title_text=\"\", row=1, col=2)\n", + "\n", + "# update layout\n", + "fig.update_layout(height=600, width=1200, title_text=\"Metro Line Analysis\", template=\"plotly_white\")\n", + "\n", + "fig.show()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 617 + }, + "id": "5yFNt4bgE5o0", + "outputId": "f4201b9e-c8d7-4aa5-99ba-064c4abc2721" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "\n", + "" + ] + }, + "metadata": {} + } + ] + }, + { + "cell_type": "code", + "source": [ + "layout_counts = metro_data['Station Layout'].value_counts()\n", + "\n", + "# creating the bar plot using Plotly\n", + "fig = px.bar(x=layout_counts.index, y=layout_counts.values,\n", + " labels={'x': 'Station Layout', 'y': 'Number of Stations'},\n", + " title='Distribution of Delhi Metro Station Layouts',\n", + " color=layout_counts.index,\n", + " color_continuous_scale='pastel')\n", + "\n", + "# updating layout for better presentation\n", + "fig.update_layout(xaxis_title=\"Station Layout\",\n", + " yaxis_title=\"Number of Stations\",\n", + " coloraxis_showscale=False,\n", + " template=\"plotly_white\")\n", + "\n", + "fig.show()" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 542 + }, + "id": "TxAaaD4dE-t2", + "outputId": "bb0d92cc-1ff5-4e4c-a951-d333e8634187" + }, + "execution_count": 15, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "\n", + "" + ] + }, + "metadata": {} + } + ] + } + ] +} \ No newline at end of file diff --git a/Geocoding.ipynb b/Geocoding.ipynb new file mode 100644 index 00000000..d03a2f5b --- /dev/null +++ b/Geocoding.ipynb @@ -0,0 +1,4169 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [], + "authorship_tag": "ABX9TyPIP+RqVychSu+tNkYPpydy", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "6d0b950655ba4ccc9a4d4616cac1b9df": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HBoxModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_8ad023399a814ee9b2ef6c81499ea5ab", + "IPY_MODEL_79649bf739a74469a4688a8b21ba48b9", + "IPY_MODEL_2bd3178cc34847c4a4f15f5dd89a7d50" + ], + "layout": "IPY_MODEL_9c8e0461c422419cbe390c4e1ae4b3b4" + } + }, + "8ad023399a814ee9b2ef6c81499ea5ab": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_120f776be44649b1997f215db5e372f1", + "placeholder": "​", + "style": "IPY_MODEL_e34422b271124c19b9a32ecd1081ec17", + "value": "100%" + } + }, + "79649bf739a74469a4688a8b21ba48b9": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_722bbe4cae1e4fcba2fb105a0808900d", + "max": 64, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_4c00ae7e8c944d658e7978a8f64c4ebf", + "value": 64 + } + }, + "2bd3178cc34847c4a4f15f5dd89a7d50": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_d239db49fdbc450e96c1989af582bcf2", + "placeholder": "​", + "style": "IPY_MODEL_1f2ad2bc3e404b3c8ceb8309d01130ff", + "value": " 64/64 [01:05<00:00,  1.03it/s]" + } + }, + "9c8e0461c422419cbe390c4e1ae4b3b4": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "120f776be44649b1997f215db5e372f1": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "e34422b271124c19b9a32ecd1081ec17": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "722bbe4cae1e4fcba2fb105a0808900d": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "4c00ae7e8c944d658e7978a8f64c4ebf": { + "model_module": "@jupyter-widgets/controls", + "model_name": "ProgressStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "d239db49fdbc450e96c1989af582bcf2": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "1f2ad2bc3e404b3c8ceb8309d01130ff": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + } + } + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "id": "SA4-uG7QFz-E" + }, + "outputs": [], + "source": [ + "%%capture\n", + "if 'google.colab' in str(get_ipython()):\n", + " !pip install leafmap mapclassify" + ] + }, + { + "cell_type": "code", + "source": [ + "import os\n", + "import re\n", + "import pandas as pd\n", + "import geopandas as gpd\n", + "import leafmap.foliumap as leafmap\n", + "from geopy.geocoders import Nominatim\n", + "from geopy.extra.rate_limiter import RateLimiter\n", + "from zipfile import ZipFile" + ], + "metadata": { + "id": "GaBwgIkaGLAv" + }, + "execution_count": 2, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "data_folder = 'data'\n", + "output_folder = 'output'\n", + "\n", + "if not os.path.exists(data_folder):\n", + " os.mkdir(data_folder)\n", + "if not os.path.exists(output_folder):\n", + " os.mkdir(output_folder)" + ], + "metadata": { + "id": "IFBuDXI2GvYW" + }, + "execution_count": 3, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "def download(url):\n", + " filename = os.path.join(data_folder, os.path.basename(url))\n", + " if not os.path.exists(filename):\n", + " from urllib.request import urlretrieve\n", + " local, _ = urlretrieve(url, filename)\n", + " print('Downloaded ' + local)\n", + "\n", + "data_url = 'https://github.com/spatialthoughts/geopython-tutorials/releases/download/data/'\n", + "\n", + "download(data_url + 'Hurricane_Evacuation_Centers.xlsx')" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "OVKdqb5IGyYU", + "outputId": "ca0b2758-b0a3-4118-cd08-c43795853fca" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Downloaded data/Hurricane_Evacuation_Centers.xlsx\n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "excel_file = 'Hurricane_Evacuation_Centers.xlsx'\n", + "excel_file_path = os.path.join(data_folder, excel_file)\n", + "address_df = pd.read_excel(excel_file_path, skiprows=[0])\n", + "address_df" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 423 + }, + "id": "sv9sdVbhHRcR", + "outputId": "0c979d1f-f281-46be-b97c-f9c06ecab806" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " CITY EC_Name \\\n", + "0 Flushing J.H.S. 185 - Queens \n", + "1 Brooklyn I.S. 258 - Brooklyn \n", + "2 Brooklyn I.S. 88 - Brooklyn \n", + "3 Bronx Walton HS - X \n", + "4 Brooklyn P.S./I.S.30 Mary White Ovington - Brooklyn \n", + ".. ... ... \n", + "59 Bronx I.S. 201 - Bronx \n", + "60 Bronx P.S. 46 - Bronx \n", + "61 Long Island City Aviation HS - Q \n", + "62 Bronx P.S. 102 - Bronx \n", + "63 Bronx Morris Heights Educational Complex - Bronx \n", + "\n", + " ADDRESS ZIP_CODE BOROCODE STATE ACCESSIBLE \n", + "0 147-26 25 Drive 11354 4 NY Y \n", + "1 141 Macon Street 11216 3 NY Y \n", + "2 544 7 Avenue 11215 3 NY Y \n", + "3 2780 Reservoir Avenue 10468 2 NY Y \n", + "4 7002 4 Avenue 11209 3 NY Y \n", + ".. ... ... ... ... ... \n", + "59 730 Bryant Avenue 10474 2 NY Y \n", + "60 2760 Briggs Avenue 10458 2 NY Y \n", + "61 45-30 36 Street 11101 4 NY Y \n", + "62 1827 Archer Street 10460 2 NY Y \n", + "63 1780 Dr. Martin Luther King Jr. Blvd 10453 2 NY Y \n", + "\n", + "[64 rows x 7 columns]" + ], + "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", + " \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", + "
CITYEC_NameADDRESSZIP_CODEBOROCODESTATEACCESSIBLE
0FlushingJ.H.S. 185 - Queens147-26 25 Drive113544NYY
1BrooklynI.S. 258 - Brooklyn141 Macon Street112163NYY
2BrooklynI.S. 88 - Brooklyn544 7 Avenue112153NYY
3BronxWalton HS - X2780 Reservoir Avenue104682NYY
4BrooklynP.S./I.S.30 Mary White Ovington - Brooklyn7002 4 Avenue112093NYY
........................
59BronxI.S. 201 - Bronx730 Bryant Avenue104742NYY
60BronxP.S. 46 - Bronx2760 Briggs Avenue104582NYY
61Long Island CityAviation HS - Q45-30 36 Street111014NYY
62BronxP.S. 102 - Bronx1827 Archer Street104602NYY
63BronxMorris Heights Educational Complex - Bronx1780 Dr. Martin Luther King Jr. Blvd104532NYY
\n", + "

64 rows × 7 columns

\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" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "address_df", + "summary": "{\n \"name\": \"address_df\",\n \"rows\": 64,\n \"fields\": [\n {\n \"column\": \"CITY\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 16,\n \"samples\": [\n \"Flushing\",\n \"Brooklyn\",\n \"Jamaica\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"EC_Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"P.S. 100 - Queens\",\n \"P.S. 268 - Queens\",\n \"J.H.S. 185 - Queens\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118 Street\",\n \"92-07 175 Street\",\n \"147-26 25 Drive\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ZIP_CODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 526,\n \"min\": 10002,\n \"max\": 11433,\n \"num_unique_values\": 56,\n \"samples\": [\n 11354,\n 10022,\n 11358\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"BOROCODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 1,\n \"max\": 5,\n \"num_unique_values\": 5,\n \"samples\": [\n 3,\n 5,\n 2\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"STATE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"NY\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ACCESSIBLE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"Y\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 5 + } + ] + }, + { + "cell_type": "code", + "source": [ + "def make_ordinal(match):\n", + " n = int(match.group(1))\n", + " if 11 <= (n % 100) <= 13:\n", + " suffix = 'th'\n", + " else:\n", + " suffix = ['th', 'st', 'nd', 'rd', 'th'][min(n % 10, 4)]\n", + " return str(n) + suffix + match.group(2)\n", + "\n", + "def update_address(row):\n", + " old_address = row['ADDRESS']\n", + " pattern = r'(\\d+)(\\s+(?:Street|Avenue|Blvd|Drive))'\n", + " result = re.sub(pattern, make_ordinal, old_address)\n", + " return result\n", + "\n", + "address_df['ADDRESS_FIXED'] = address_df.apply(update_address, axis=1)\n", + "address_df" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 423 + }, + "id": "RfGP-RXpHtM2", + "outputId": "63165ab7-fe94-4352-e1da-ea706c450b30" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " CITY EC_Name \\\n", + "0 Flushing J.H.S. 185 - Queens \n", + "1 Brooklyn I.S. 258 - Brooklyn \n", + "2 Brooklyn I.S. 88 - Brooklyn \n", + "3 Bronx Walton HS - X \n", + "4 Brooklyn P.S./I.S.30 Mary White Ovington - Brooklyn \n", + ".. ... ... \n", + "59 Bronx I.S. 201 - Bronx \n", + "60 Bronx P.S. 46 - Bronx \n", + "61 Long Island City Aviation HS - Q \n", + "62 Bronx P.S. 102 - Bronx \n", + "63 Bronx Morris Heights Educational Complex - Bronx \n", + "\n", + " ADDRESS ZIP_CODE BOROCODE STATE ACCESSIBLE \\\n", + "0 147-26 25 Drive 11354 4 NY Y \n", + "1 141 Macon Street 11216 3 NY Y \n", + "2 544 7 Avenue 11215 3 NY Y \n", + "3 2780 Reservoir Avenue 10468 2 NY Y \n", + "4 7002 4 Avenue 11209 3 NY Y \n", + ".. ... ... ... ... ... \n", + "59 730 Bryant Avenue 10474 2 NY Y \n", + "60 2760 Briggs Avenue 10458 2 NY Y \n", + "61 45-30 36 Street 11101 4 NY Y \n", + "62 1827 Archer Street 10460 2 NY Y \n", + "63 1780 Dr. Martin Luther King Jr. Blvd 10453 2 NY Y \n", + "\n", + " ADDRESS_FIXED \n", + "0 147-26 25th Drive \n", + "1 141 Macon Street \n", + "2 544 7th Avenue \n", + "3 2780 Reservoir Avenue \n", + "4 7002 4th Avenue \n", + ".. ... \n", + "59 730 Bryant Avenue \n", + "60 2760 Briggs Avenue \n", + "61 45-30 36th Street \n", + "62 1827 Archer Street \n", + "63 1780 Dr. Martin Luther King Jr. Blvd \n", + "\n", + "[64 rows x 8 columns]" + ], + "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", + " \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", + "
CITYEC_NameADDRESSZIP_CODEBOROCODESTATEACCESSIBLEADDRESS_FIXED
0FlushingJ.H.S. 185 - Queens147-26 25 Drive113544NYY147-26 25th Drive
1BrooklynI.S. 258 - Brooklyn141 Macon Street112163NYY141 Macon Street
2BrooklynI.S. 88 - Brooklyn544 7 Avenue112153NYY544 7th Avenue
3BronxWalton HS - X2780 Reservoir Avenue104682NYY2780 Reservoir Avenue
4BrooklynP.S./I.S.30 Mary White Ovington - Brooklyn7002 4 Avenue112093NYY7002 4th Avenue
...........................
59BronxI.S. 201 - Bronx730 Bryant Avenue104742NYY730 Bryant Avenue
60BronxP.S. 46 - Bronx2760 Briggs Avenue104582NYY2760 Briggs Avenue
61Long Island CityAviation HS - Q45-30 36 Street111014NYY45-30 36th Street
62BronxP.S. 102 - Bronx1827 Archer Street104602NYY1827 Archer Street
63BronxMorris Heights Educational Complex - Bronx1780 Dr. Martin Luther King Jr. Blvd104532NYY1780 Dr. Martin Luther King Jr. Blvd
\n", + "

64 rows × 8 columns

\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" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "address_df", + "summary": "{\n \"name\": \"address_df\",\n \"rows\": 64,\n \"fields\": [\n {\n \"column\": \"CITY\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 16,\n \"samples\": [\n \"Flushing\",\n \"Brooklyn\",\n \"Jamaica\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"EC_Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"P.S. 100 - Queens\",\n \"P.S. 268 - Queens\",\n \"J.H.S. 185 - Queens\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118 Street\",\n \"92-07 175 Street\",\n \"147-26 25 Drive\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ZIP_CODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 526,\n \"min\": 10002,\n \"max\": 11433,\n \"num_unique_values\": 56,\n \"samples\": [\n 11354,\n 10022,\n 11358\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"BOROCODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 1,\n \"max\": 5,\n \"num_unique_values\": 5,\n \"samples\": [\n 3,\n 5,\n 2\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"STATE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"NY\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ACCESSIBLE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"Y\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS_FIXED\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "code", + "source": [ + "address_df['Full_Address'] = (\n", + " address_df['ADDRESS_FIXED'] + ',' +\n", + " 'NYC' + ',' +\n", + " address_df['STATE']+ ',' +\n", + " address_df['ZIP_CODE'].astype(str))\n", + "address_df" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 475 + }, + "id": "V9aL36GRIBkb", + "outputId": "4afccb71-0544-42f1-a7b3-d136e5f0d790" + }, + "execution_count": 7, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " CITY EC_Name \\\n", + "0 Flushing J.H.S. 185 - Queens \n", + "1 Brooklyn I.S. 258 - Brooklyn \n", + "2 Brooklyn I.S. 88 - Brooklyn \n", + "3 Bronx Walton HS - X \n", + "4 Brooklyn P.S./I.S.30 Mary White Ovington - Brooklyn \n", + ".. ... ... \n", + "59 Bronx I.S. 201 - Bronx \n", + "60 Bronx P.S. 46 - Bronx \n", + "61 Long Island City Aviation HS - Q \n", + "62 Bronx P.S. 102 - Bronx \n", + "63 Bronx Morris Heights Educational Complex - Bronx \n", + "\n", + " ADDRESS ZIP_CODE BOROCODE STATE ACCESSIBLE \\\n", + "0 147-26 25 Drive 11354 4 NY Y \n", + "1 141 Macon Street 11216 3 NY Y \n", + "2 544 7 Avenue 11215 3 NY Y \n", + "3 2780 Reservoir Avenue 10468 2 NY Y \n", + "4 7002 4 Avenue 11209 3 NY Y \n", + ".. ... ... ... ... ... \n", + "59 730 Bryant Avenue 10474 2 NY Y \n", + "60 2760 Briggs Avenue 10458 2 NY Y \n", + "61 45-30 36 Street 11101 4 NY Y \n", + "62 1827 Archer Street 10460 2 NY Y \n", + "63 1780 Dr. Martin Luther King Jr. Blvd 10453 2 NY Y \n", + "\n", + " ADDRESS_FIXED \\\n", + "0 147-26 25th Drive \n", + "1 141 Macon Street \n", + "2 544 7th Avenue \n", + "3 2780 Reservoir Avenue \n", + "4 7002 4th Avenue \n", + ".. ... \n", + "59 730 Bryant Avenue \n", + "60 2760 Briggs Avenue \n", + "61 45-30 36th Street \n", + "62 1827 Archer Street \n", + "63 1780 Dr. Martin Luther King Jr. Blvd \n", + "\n", + " Full_Address \n", + "0 147-26 25th Drive,NYC,NY,11354 \n", + "1 141 Macon Street,NYC,NY,11216 \n", + "2 544 7th Avenue,NYC,NY,11215 \n", + "3 2780 Reservoir Avenue,NYC,NY,10468 \n", + "4 7002 4th Avenue,NYC,NY,11209 \n", + ".. ... \n", + "59 730 Bryant Avenue,NYC,NY,10474 \n", + "60 2760 Briggs Avenue,NYC,NY,10458 \n", + "61 45-30 36th Street,NYC,NY,11101 \n", + "62 1827 Archer Street,NYC,NY,10460 \n", + "63 1780 Dr. Martin Luther King Jr. Blvd,NYC,NY,10453 \n", + "\n", + "[64 rows x 9 columns]" + ], + "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", + " \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", + "
CITYEC_NameADDRESSZIP_CODEBOROCODESTATEACCESSIBLEADDRESS_FIXEDFull_Address
0FlushingJ.H.S. 185 - Queens147-26 25 Drive113544NYY147-26 25th Drive147-26 25th Drive,NYC,NY,11354
1BrooklynI.S. 258 - Brooklyn141 Macon Street112163NYY141 Macon Street141 Macon Street,NYC,NY,11216
2BrooklynI.S. 88 - Brooklyn544 7 Avenue112153NYY544 7th Avenue544 7th Avenue,NYC,NY,11215
3BronxWalton HS - X2780 Reservoir Avenue104682NYY2780 Reservoir Avenue2780 Reservoir Avenue,NYC,NY,10468
4BrooklynP.S./I.S.30 Mary White Ovington - Brooklyn7002 4 Avenue112093NYY7002 4th Avenue7002 4th Avenue,NYC,NY,11209
..............................
59BronxI.S. 201 - Bronx730 Bryant Avenue104742NYY730 Bryant Avenue730 Bryant Avenue,NYC,NY,10474
60BronxP.S. 46 - Bronx2760 Briggs Avenue104582NYY2760 Briggs Avenue2760 Briggs Avenue,NYC,NY,10458
61Long Island CityAviation HS - Q45-30 36 Street111014NYY45-30 36th Street45-30 36th Street,NYC,NY,11101
62BronxP.S. 102 - Bronx1827 Archer Street104602NYY1827 Archer Street1827 Archer Street,NYC,NY,10460
63BronxMorris Heights Educational Complex - Bronx1780 Dr. Martin Luther King Jr. Blvd104532NYY1780 Dr. Martin Luther King Jr. Blvd1780 Dr. Martin Luther King Jr. Blvd,NYC,NY,10453
\n", + "

64 rows × 9 columns

\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" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "address_df", + "summary": "{\n \"name\": \"address_df\",\n \"rows\": 64,\n \"fields\": [\n {\n \"column\": \"CITY\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 16,\n \"samples\": [\n \"Flushing\",\n \"Brooklyn\",\n \"Jamaica\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"EC_Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"P.S. 100 - Queens\",\n \"P.S. 268 - Queens\",\n \"J.H.S. 185 - Queens\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118 Street\",\n \"92-07 175 Street\",\n \"147-26 25 Drive\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ZIP_CODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 526,\n \"min\": 10002,\n \"max\": 11433,\n \"num_unique_values\": 56,\n \"samples\": [\n 11354,\n 10022,\n 11358\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"BOROCODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 1,\n \"max\": 5,\n \"num_unique_values\": 5,\n \"samples\": [\n 3,\n 5,\n 2\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"STATE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"NY\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ACCESSIBLE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"Y\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS_FIXED\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Full_Address\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street,NYC,NY,11420\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 7 + } + ] + }, + { + "cell_type": "code", + "source": [ + "from tqdm.notebook import tqdm\n", + "\n", + "tqdm.pandas()\n", + "\n", + "locator = Nominatim(user_agent='spatialthoughts', timeout=10)\n", + "geocode = RateLimiter(locator.geocode, min_delay_seconds=1)\n", + "\n", + "address_df_pd = address_df.copy()\n", + "address_df_pd['location'] = address_df_pd['Full_Address'].progress_apply(geocode)\n", + "address_df_pd" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 629, + "referenced_widgets": [ + "6d0b950655ba4ccc9a4d4616cac1b9df", + "8ad023399a814ee9b2ef6c81499ea5ab", + "79649bf739a74469a4688a8b21ba48b9", + "2bd3178cc34847c4a4f15f5dd89a7d50", + "9c8e0461c422419cbe390c4e1ae4b3b4", + "120f776be44649b1997f215db5e372f1", + "e34422b271124c19b9a32ecd1081ec17", + "722bbe4cae1e4fcba2fb105a0808900d", + "4c00ae7e8c944d658e7978a8f64c4ebf", + "d239db49fdbc450e96c1989af582bcf2", + "1f2ad2bc3e404b3c8ceb8309d01130ff" + ] + }, + "id": "iJE1p6QeIcQY", + "outputId": "f8535a32-f517-4e26-df74-97e075c420a8" + }, + "execution_count": 8, + "outputs": [ + { + "output_type": "display_data", + "data": { + "text/plain": [ + " 0%| | 0/64 [00:00\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", + " \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", + "
CITYEC_NameADDRESSZIP_CODEBOROCODESTATEACCESSIBLEADDRESS_FIXEDFull_Addresslocation
0FlushingJ.H.S. 185 - Queens147-26 25 Drive113544NYY147-26 25th Drive147-26 25th Drive,NYC,NY,11354(Junior High School 185, 147-26, 25th Drive, L...
1BrooklynI.S. 258 - Brooklyn141 Macon Street112163NYY141 Macon Street141 Macon Street,NYC,NY,11216(Junior High School 258, 141, Macon Street, Be...
2BrooklynI.S. 88 - Brooklyn544 7 Avenue112153NYY544 7th Avenue544 7th Avenue,NYC,NY,11215(544, 7th Avenue, Greenwood Heights, Brooklyn,...
3BronxWalton HS - X2780 Reservoir Avenue104682NYY2780 Reservoir Avenue2780 Reservoir Avenue,NYC,NY,10468(2780, Reservoir Avenue, Kingsbridge Heights, ...
4BrooklynP.S./I.S.30 Mary White Ovington - Brooklyn7002 4 Avenue112093NYY7002 4th Avenue7002 4th Avenue,NYC,NY,11209(7002, 4th Avenue, Bay Ridge, Brooklyn, Kings ...
.................................
59BronxI.S. 201 - Bronx730 Bryant Avenue104742NYY730 Bryant Avenue730 Bryant Avenue,NYC,NY,10474(730, Bryant Avenue, Hunts Point, The Bronx, B...
60BronxP.S. 46 - Bronx2760 Briggs Avenue104582NYY2760 Briggs Avenue2760 Briggs Avenue,NYC,NY,10458(2760, Briggs Avenue, Bedford Park, The Bronx,...
61Long Island CityAviation HS - Q45-30 36 Street111014NYY45-30 36th Street45-30 36th Street,NYC,NY,11101(45-30, 36th Street, Sunnyside, Queens, Queens...
62BronxP.S. 102 - Bronx1827 Archer Street104602NYY1827 Archer Street1827 Archer Street,NYC,NY,10460(Public School 102, 1827, Archer Street, The B...
63BronxMorris Heights Educational Complex - Bronx1780 Dr. Martin Luther King Jr. Blvd104532NYY1780 Dr. Martin Luther King Jr. Blvd1780 Dr. Martin Luther King Jr. Blvd,NYC,NY,10453(East 125th Street, Manhattan Community Board ...
\n", + "

64 rows × 10 columns

\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" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "address_df_pd", + "summary": "{\n \"name\": \"address_df_pd\",\n \"rows\": 64,\n \"fields\": [\n {\n \"column\": \"CITY\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 16,\n \"samples\": [\n \"Flushing\",\n \"Brooklyn\",\n \"Jamaica\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"EC_Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"P.S. 100 - Queens\",\n \"P.S. 268 - Queens\",\n \"J.H.S. 185 - Queens\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118 Street\",\n \"92-07 175 Street\",\n \"147-26 25 Drive\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ZIP_CODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 526,\n \"min\": 10002,\n \"max\": 11433,\n \"num_unique_values\": 56,\n \"samples\": [\n 11354,\n 10022,\n 11358\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"BOROCODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 1,\n \"max\": 5,\n \"num_unique_values\": 5,\n \"samples\": [\n 3,\n 5,\n 2\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"STATE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"NY\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ACCESSIBLE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"Y\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS_FIXED\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Full_Address\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street,NYC,NY,11420\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"location\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 8 + } + ] + }, + { + "cell_type": "code", + "source": [ + "address_df_pd['latitude'] = address_df_pd['location'].apply(lambda loc: loc.latitude if loc else None)\n", + "address_df_pd['longitude'] = address_df_pd['location'].apply(lambda loc: loc.longitude if loc else None)\n", + "address_df_pd" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 770 + }, + "id": "A9TlXI7WI5tU", + "outputId": "2dee506a-fbf9-413a-f784-68755e50dc72" + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " CITY EC_Name \\\n", + "0 Flushing J.H.S. 185 - Queens \n", + "1 Brooklyn I.S. 258 - Brooklyn \n", + "2 Brooklyn I.S. 88 - Brooklyn \n", + "3 Bronx Walton HS - X \n", + "4 Brooklyn P.S./I.S.30 Mary White Ovington - Brooklyn \n", + ".. ... ... \n", + "59 Bronx I.S. 201 - Bronx \n", + "60 Bronx P.S. 46 - Bronx \n", + "61 Long Island City Aviation HS - Q \n", + "62 Bronx P.S. 102 - Bronx \n", + "63 Bronx Morris Heights Educational Complex - Bronx \n", + "\n", + " ADDRESS ZIP_CODE BOROCODE STATE ACCESSIBLE \\\n", + "0 147-26 25 Drive 11354 4 NY Y \n", + "1 141 Macon Street 11216 3 NY Y \n", + "2 544 7 Avenue 11215 3 NY Y \n", + "3 2780 Reservoir Avenue 10468 2 NY Y \n", + "4 7002 4 Avenue 11209 3 NY Y \n", + ".. ... ... ... ... ... \n", + "59 730 Bryant Avenue 10474 2 NY Y \n", + "60 2760 Briggs Avenue 10458 2 NY Y \n", + "61 45-30 36 Street 11101 4 NY Y \n", + "62 1827 Archer Street 10460 2 NY Y \n", + "63 1780 Dr. Martin Luther King Jr. Blvd 10453 2 NY Y \n", + "\n", + " ADDRESS_FIXED \\\n", + "0 147-26 25th Drive \n", + "1 141 Macon Street \n", + "2 544 7th Avenue \n", + "3 2780 Reservoir Avenue \n", + "4 7002 4th Avenue \n", + ".. ... \n", + "59 730 Bryant Avenue \n", + "60 2760 Briggs Avenue \n", + "61 45-30 36th Street \n", + "62 1827 Archer Street \n", + "63 1780 Dr. Martin Luther King Jr. Blvd \n", + "\n", + " Full_Address \\\n", + "0 147-26 25th Drive,NYC,NY,11354 \n", + "1 141 Macon Street,NYC,NY,11216 \n", + "2 544 7th Avenue,NYC,NY,11215 \n", + "3 2780 Reservoir Avenue,NYC,NY,10468 \n", + "4 7002 4th Avenue,NYC,NY,11209 \n", + ".. ... \n", + "59 730 Bryant Avenue,NYC,NY,10474 \n", + "60 2760 Briggs Avenue,NYC,NY,10458 \n", + "61 45-30 36th Street,NYC,NY,11101 \n", + "62 1827 Archer Street,NYC,NY,10460 \n", + "63 1780 Dr. Martin Luther King Jr. Blvd,NYC,NY,10453 \n", + "\n", + " location latitude longitude \n", + "0 (Junior High School 185, 147-26, 25th Drive, L... 40.774912 -73.818619 \n", + "1 (Junior High School 258, 141, Macon Street, Be... 40.681918 -73.945597 \n", + "2 (544, 7th Avenue, Greenwood Heights, Brooklyn,... 40.660181 -73.987931 \n", + "3 (2780, Reservoir Avenue, Kingsbridge Heights, ... 40.870261 -73.896569 \n", + "4 (7002, 4th Avenue, Bay Ridge, Brooklyn, Kings ... 40.633625 -74.024038 \n", + ".. ... ... ... \n", + "59 (730, Bryant Avenue, Hunts Point, The Bronx, B... 40.816040 -73.885264 \n", + "60 (2760, Briggs Avenue, Bedford Park, The Bronx,... 40.867729 -73.890294 \n", + "61 (45-30, 36th Street, Sunnyside, Queens, Queens... 40.743475 -73.929464 \n", + "62 (Public School 102, 1827, Archer Street, The B... 40.838106 -73.865790 \n", + "63 (East 125th Street, Manhattan Community Board ... 40.802729 -73.933493 \n", + "\n", + "[64 rows x 12 columns]" + ], + "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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
CITYEC_NameADDRESSZIP_CODEBOROCODESTATEACCESSIBLEADDRESS_FIXEDFull_Addresslocationlatitudelongitude
0FlushingJ.H.S. 185 - Queens147-26 25 Drive113544NYY147-26 25th Drive147-26 25th Drive,NYC,NY,11354(Junior High School 185, 147-26, 25th Drive, L...40.774912-73.818619
1BrooklynI.S. 258 - Brooklyn141 Macon Street112163NYY141 Macon Street141 Macon Street,NYC,NY,11216(Junior High School 258, 141, Macon Street, Be...40.681918-73.945597
2BrooklynI.S. 88 - Brooklyn544 7 Avenue112153NYY544 7th Avenue544 7th Avenue,NYC,NY,11215(544, 7th Avenue, Greenwood Heights, Brooklyn,...40.660181-73.987931
3BronxWalton HS - X2780 Reservoir Avenue104682NYY2780 Reservoir Avenue2780 Reservoir Avenue,NYC,NY,10468(2780, Reservoir Avenue, Kingsbridge Heights, ...40.870261-73.896569
4BrooklynP.S./I.S.30 Mary White Ovington - Brooklyn7002 4 Avenue112093NYY7002 4th Avenue7002 4th Avenue,NYC,NY,11209(7002, 4th Avenue, Bay Ridge, Brooklyn, Kings ...40.633625-74.024038
.......................................
59BronxI.S. 201 - Bronx730 Bryant Avenue104742NYY730 Bryant Avenue730 Bryant Avenue,NYC,NY,10474(730, Bryant Avenue, Hunts Point, The Bronx, B...40.816040-73.885264
60BronxP.S. 46 - Bronx2760 Briggs Avenue104582NYY2760 Briggs Avenue2760 Briggs Avenue,NYC,NY,10458(2760, Briggs Avenue, Bedford Park, The Bronx,...40.867729-73.890294
61Long Island CityAviation HS - Q45-30 36 Street111014NYY45-30 36th Street45-30 36th Street,NYC,NY,11101(45-30, 36th Street, Sunnyside, Queens, Queens...40.743475-73.929464
62BronxP.S. 102 - Bronx1827 Archer Street104602NYY1827 Archer Street1827 Archer Street,NYC,NY,10460(Public School 102, 1827, Archer Street, The B...40.838106-73.865790
63BronxMorris Heights Educational Complex - Bronx1780 Dr. Martin Luther King Jr. Blvd104532NYY1780 Dr. Martin Luther King Jr. Blvd1780 Dr. Martin Luther King Jr. Blvd,NYC,NY,10453(East 125th Street, Manhattan Community Board ...40.802729-73.933493
\n", + "

64 rows × 12 columns

\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" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "address_df_pd", + "summary": "{\n \"name\": \"address_df_pd\",\n \"rows\": 64,\n \"fields\": [\n {\n \"column\": \"CITY\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 16,\n \"samples\": [\n \"Flushing\",\n \"Brooklyn\",\n \"Jamaica\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"EC_Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"P.S. 100 - Queens\",\n \"P.S. 268 - Queens\",\n \"J.H.S. 185 - Queens\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118 Street\",\n \"92-07 175 Street\",\n \"147-26 25 Drive\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ZIP_CODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 526,\n \"min\": 10002,\n \"max\": 11433,\n \"num_unique_values\": 56,\n \"samples\": [\n 11354,\n 10022,\n 11358\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"BOROCODE\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1,\n \"min\": 1,\n \"max\": 5,\n \"num_unique_values\": 5,\n \"samples\": [\n 3,\n 5,\n 2\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"STATE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"NY\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ACCESSIBLE\",\n \"properties\": {\n \"dtype\": \"category\",\n \"num_unique_values\": 1,\n \"samples\": [\n \"Y\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"ADDRESS_FIXED\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Full_Address\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street,NYC,NY,11420\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"location\",\n \"properties\": {\n \"dtype\": \"object\",\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"latitude\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.08069450816949479,\n \"min\": 40.5419561,\n \"max\": 40.8882154,\n \"num_unique_values\": 63,\n \"samples\": [\n 40.8381057\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"longitude\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.0897517193915806,\n \"min\": -74.2139783,\n \"max\": -73.7288703,\n \"num_unique_values\": 63,\n \"samples\": [\n -73.8657904\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "source": [ + "failed = address_df_pd[address_df_pd['location'].isna()]\n", + "failed" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 89 + }, + "id": "RgykaMXfJMS2", + "outputId": "4fce9786-291d-4a46-c817-685687cbbc1f" + }, + "execution_count": 10, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " CITY EC_Name ADDRESS ZIP_CODE BOROCODE STATE \\\n", + "54 New York P.S. 48 - Manhattan 4360-78 Broadway 10033 1 NY \n", + "\n", + " ACCESSIBLE ADDRESS_FIXED Full_Address location \\\n", + "54 Y 4360-78 Broadway 4360-78 Broadway,NYC,NY,10033 None \n", + "\n", + " latitude longitude \n", + "54 NaN NaN " + ], + "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", + "
CITYEC_NameADDRESSZIP_CODEBOROCODESTATEACCESSIBLEADDRESS_FIXEDFull_Addresslocationlatitudelongitude
54New YorkP.S. 48 - Manhattan4360-78 Broadway100331NYY4360-78 Broadway4360-78 Broadway,NYC,NY,10033NoneNaNNaN
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "failed", + "repr_error": "0" + } + }, + "metadata": {}, + "execution_count": 10 + } + ] + }, + { + "cell_type": "code", + "source": [ + "address_df_pd.loc[54, ['latitude', 'longitude']] = (40.85339,-73.93350)" + ], + "metadata": { + "id": "R_0WYKkEJgGt" + }, + "execution_count": 11, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "address_df_pd = address_df_pd[['EC_Name', 'Full_Address', 'latitude', 'longitude']]\n", + "address_df_pd.rename(columns = {'EC_Name': 'Name', 'Full_Address': 'Address'}, inplace=True)" + ], + "metadata": { + "id": "vOWJyoTyJvN7" + }, + "execution_count": 12, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "geometry = gpd.points_from_xy(address_df_pd.longitude, address_df_pd.latitude)\n", + "address_gdf = gpd.GeoDataFrame(address_df_pd, crs='EPSG:4326', geometry=geometry)\n", + "address_gdf" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 423 + }, + "id": "mKML0SpzJ68G", + "outputId": "14b1518b-7d91-4a57-b759-c68b822bdd57" + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Name \\\n", + "0 J.H.S. 185 - Queens \n", + "1 I.S. 258 - Brooklyn \n", + "2 I.S. 88 - Brooklyn \n", + "3 Walton HS - X \n", + "4 P.S./I.S.30 Mary White Ovington - Brooklyn \n", + ".. ... \n", + "59 I.S. 201 - Bronx \n", + "60 P.S. 46 - Bronx \n", + "61 Aviation HS - Q \n", + "62 P.S. 102 - Bronx \n", + "63 Morris Heights Educational Complex - Bronx \n", + "\n", + " Address latitude longitude \\\n", + "0 147-26 25th Drive,NYC,NY,11354 40.774912 -73.818619 \n", + "1 141 Macon Street,NYC,NY,11216 40.681918 -73.945597 \n", + "2 544 7th Avenue,NYC,NY,11215 40.660181 -73.987931 \n", + "3 2780 Reservoir Avenue,NYC,NY,10468 40.870261 -73.896569 \n", + "4 7002 4th Avenue,NYC,NY,11209 40.633625 -74.024038 \n", + ".. ... ... ... \n", + "59 730 Bryant Avenue,NYC,NY,10474 40.816040 -73.885264 \n", + "60 2760 Briggs Avenue,NYC,NY,10458 40.867729 -73.890294 \n", + "61 45-30 36th Street,NYC,NY,11101 40.743475 -73.929464 \n", + "62 1827 Archer Street,NYC,NY,10460 40.838106 -73.865790 \n", + "63 1780 Dr. Martin Luther King Jr. Blvd,NYC,NY,10453 40.802729 -73.933493 \n", + "\n", + " geometry \n", + "0 POINT (-73.81862 40.77491) \n", + "1 POINT (-73.9456 40.68192) \n", + "2 POINT (-73.98793 40.66018) \n", + "3 POINT (-73.89657 40.87026) \n", + "4 POINT (-74.02404 40.63362) \n", + ".. ... \n", + "59 POINT (-73.88526 40.81604) \n", + "60 POINT (-73.89029 40.86773) \n", + "61 POINT (-73.92946 40.74347) \n", + "62 POINT (-73.86579 40.83811) \n", + "63 POINT (-73.93349 40.80273) \n", + "\n", + "[64 rows x 5 columns]" + ], + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameAddresslatitudelongitudegeometry
0J.H.S. 185 - Queens147-26 25th Drive,NYC,NY,1135440.774912-73.818619POINT (-73.81862 40.77491)
1I.S. 258 - Brooklyn141 Macon Street,NYC,NY,1121640.681918-73.945597POINT (-73.9456 40.68192)
2I.S. 88 - Brooklyn544 7th Avenue,NYC,NY,1121540.660181-73.987931POINT (-73.98793 40.66018)
3Walton HS - X2780 Reservoir Avenue,NYC,NY,1046840.870261-73.896569POINT (-73.89657 40.87026)
4P.S./I.S.30 Mary White Ovington - Brooklyn7002 4th Avenue,NYC,NY,1120940.633625-74.024038POINT (-74.02404 40.63362)
..................
59I.S. 201 - Bronx730 Bryant Avenue,NYC,NY,1047440.816040-73.885264POINT (-73.88526 40.81604)
60P.S. 46 - Bronx2760 Briggs Avenue,NYC,NY,1045840.867729-73.890294POINT (-73.89029 40.86773)
61Aviation HS - Q45-30 36th Street,NYC,NY,1110140.743475-73.929464POINT (-73.92946 40.74347)
62P.S. 102 - Bronx1827 Archer Street,NYC,NY,1046040.838106-73.865790POINT (-73.86579 40.83811)
63Morris Heights Educational Complex - Bronx1780 Dr. Martin Luther King Jr. Blvd,NYC,NY,1045340.802729-73.933493POINT (-73.93349 40.80273)
\n", + "

64 rows × 5 columns

\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" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "address_gdf", + "summary": "{\n \"name\": \"address_gdf\",\n \"rows\": 64,\n \"fields\": [\n {\n \"column\": \"Name\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"P.S. 100 - Queens\",\n \"P.S. 268 - Queens\",\n \"J.H.S. 185 - Queens\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Address\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"111-11 118th Street,NYC,NY,11420\",\n \"92-07 175th Street,NYC,NY,11433\",\n \"147-26 25th Drive,NYC,NY,11354\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"latitude\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.08140922214849122,\n \"min\": 40.5419561,\n \"max\": 40.8882154,\n \"num_unique_values\": 64,\n \"samples\": [\n 40.6798099,\n 40.7062043,\n 40.7749125\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"longitude\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.08903923212407928,\n \"min\": -74.2139783,\n \"max\": -73.7288703,\n \"num_unique_values\": 64,\n \"samples\": [\n -73.8213369,\n -73.7850836,\n -73.8186194\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"geometry\",\n \"properties\": {\n \"dtype\": \"geometry\",\n \"num_unique_values\": 64,\n \"samples\": [\n \"POINT (-73.8213369 40.6798099)\",\n \"POINT (-73.7850836 40.7062043)\",\n \"POINT (-73.8186194 40.7749125)\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [ + "import folium\n", + "m = leafmap.Map(width=800, height=500)\n", + "address_gdf.explore(\n", + " m=m,\n", + " marker_type='marker',\n", + " marker_kwds={\n", + " 'icon': folium.Icon(color='#fdbb84', icon='hurricane', prefix='fa')\n", + " }\n", + ")\n", + "m.zoom_to_gdf(address_gdf)\n", + "m" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 522 + }, + "id": "HoHHNbb5KKjI", + "outputId": "91b07d68-f54a-42b2-cfaa-ab53aecdbd53" + }, + "execution_count": 14, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "" + ], + "text/html": [ + "" + ] + }, + "metadata": {}, + "execution_count": 14 + } + ] + }, + { + "cell_type": "code", + "source": [ + "output_file = 'hurricane_evacuation_centers.shp'\n", + "output_path = os.path.join(output_folder, output_file)\n", + "\n", + "address_gdf.to_file(filename=output_path)" + ], + "metadata": { + "id": "O8YXQ13ZKaZ4" + }, + "execution_count": 15, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "output_zip_file = 'hurricane_evacuation_centers.zip'\n", + "output_zip_path = os.path.join(output_folder, output_zip_file)\n", + "\n", + "sidecar_files = [\n", + " os.path.join(output_folder, file)\n", + " for file in os.listdir(output_folder)\n", + " if file.endswith(('shp', 'shx', 'dbf', 'prj'))\n", + "]\n", + "\n", + "with ZipFile(output_zip_path, 'w') as zip_object:\n", + " for sidecar in sidecar_files:\n", + " zip_object.write(sidecar, os.path.basename(sidecar))" + ], + "metadata": { + "id": "zm5wtLD_KfDM" + }, + "execution_count": 16, + "outputs": [] + } + ] +} \ No newline at end of file diff --git a/Login/app.js b/Login/app.js deleted file mode 100644 index 92280ee9..00000000 --- a/Login/app.js +++ /dev/null @@ -1,15 +0,0 @@ -import { Ehh } from "https://brajesh825.github.io/ehh/index.js"; -import { nodeConfig } from "./user/config/nodeConfig.js"; -import { browserConfig } from "./user/config/browserConfig.js"; - -try { - if (typeof window === "undefined") { - console.log("Node"); - new Ehh(nodeConfig).start(); - } else { - console.log("Browser"); - new Ehh(browserConfig).start(); - } -} catch (error) { - console.log(error.message); -} diff --git a/Login/index.html b/Login/index.html deleted file mode 100644 index 86c4ebf9..00000000 --- a/Login/index.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - Document - -
- -
- - -
- - - - diff --git a/Login/login.html b/Login/login.html deleted file mode 100644 index b4c328e2..00000000 --- a/Login/login.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - Document - - - - - \ No newline at end of file diff --git a/Login/package.json b/Login/package.json deleted file mode 100644 index e69de29b..00000000 diff --git a/Login/styles.css b/Login/styles.css deleted file mode 100644 index 70905d5a..00000000 --- a/Login/styles.css +++ /dev/null @@ -1,64 +0,0 @@ -* { - margin: 0; - padding: 0; - } - - /* .tasks { - border: 1px solid black; - padding: 1rem; - display: flex; - flex-direction: row; - flex-wrap: wrap; - border-radius: 10px; - } - - .task { - width: 200px; - border: 1px solid pink; - border-radius: 10px; - margin: 1rem; - padding: 1rem; - } */ - - #ehh { - margin-top: 2rem; - position: absolute; - left: 50%; - transform: translate(-50%); - } - - nav { - padding-block: 1rem; - text-align: center; - } - - nav a { - padding: 0.5rem 1rem; - } - - form { - display: flex; - flex-direction: column; - } - - .addTaskForm { - display: flex; - flex-direction: row; - } - - label, - input, - select, - button { - margin-block: 0.2rem; - } - - ul { - padding-left: 1rem; - } - #user-form{ - display: none; - } - #search-form{ - display: none; - } \ No newline at end of file diff --git a/Login/user/config/browserConfig.js b/Login/user/config/browserConfig.js deleted file mode 100644 index e527a4d0..00000000 --- a/Login/user/config/browserConfig.js +++ /dev/null @@ -1,16 +0,0 @@ -const browserConfig = { - name: "EhhStart", - env: "Browser", - Port: "4000", - host: window.location.origin, - Entity: { - Ehh: "/user/entity/Ehh/index.js", - Github: "/user/entity/Github/index.js", - Gitlab: "/user/entity/Gitlab/index.js", - Godaddy: "/user/entity/Godaddy/index.js", - }, - homePage: "#Home", - }; - - export { browserConfig }; - \ No newline at end of file diff --git a/Login/user/config/nodeConfig.js b/Login/user/config/nodeConfig.js deleted file mode 100644 index fd93b86a..00000000 --- a/Login/user/config/nodeConfig.js +++ /dev/null @@ -1,10 +0,0 @@ -const nodeConfig = { - name: "EhhStart", - env: "Browser", - Port: "4000", - Entity: { - Task: "/user/entity/task.js", - }, - }; - - export { nodeConfig }; \ No newline at end of file diff --git a/Login/user/entity/Ehh/Home/index.js b/Login/user/entity/Ehh/Home/index.js deleted file mode 100644 index 9bcf94e1..00000000 --- a/Login/user/entity/Ehh/Home/index.js +++ /dev/null @@ -1,27 +0,0 @@ -const Home = { - scope: "Browser", - name: "HomePage", - path: "^#Home$", - entity: "Ehh", - model: { - data: [], - }, - view: function (model) { - var elim = `

${model.heading}

-

${model.text}

-

-

Lets get started by signing up!

`; - document.getElementById("ehh").innerHTML = elim; - }, - controller: { - name: "HomePage", - callback: async (event, view) => { - view({ - heading: "Everything happens here", - text: "Wecome to Ehh", - }); - }, - }, -}; - -export { Home }; diff --git a/Login/user/entity/Ehh/index.js b/Login/user/entity/Ehh/index.js deleted file mode 100644 index ee5ea893..00000000 --- a/Login/user/entity/Ehh/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { Home } from "./Home/index.js"; - -const Ehh = { Home }; - -export { Ehh }; diff --git a/Login/user/entity/Login/index.js b/Login/user/entity/Login/index.js deleted file mode 100644 index e69de29b..00000000 diff --git a/index.html b/index.html index 67907161..adfe0f40 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Best Engineering Notes | Chaibasa engineering college + Top Engineering Notes | Chatgpt engineering college @@ -109,7 +109,7 @@

BRANCHES IN CEC

electrical and electronics engineering image - EEE + ELE
Electrical and Electronics Engineering. EEE is an engineering discipline which deals with Electrical and Machine technology, Electrons, Circuit analysis, Electromagnetism, Instrumentations, Materials for electrical engineering,