From 3510fb3b79d39fd8786fcf63a9dc50705d4b8c25 Mon Sep 17 00:00:00 2001 From: Atefeh Hezavehei Date: Sun, 30 May 2021 11:28:49 +0200 Subject: [PATCH 1/3] lab --- .ipynb_checkpoints/ufos-checkpoint.ipynb | 77 ++++++++++++++++++++++++ ufos.ipynb | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 .ipynb_checkpoints/ufos-checkpoint.ipynb diff --git a/.ipynb_checkpoints/ufos-checkpoint.ipynb b/.ipynb_checkpoints/ufos-checkpoint.ipynb new file mode 100644 index 0000000..4992ba6 --- /dev/null +++ b/.ipynb_checkpoints/ufos-checkpoint.ipynb @@ -0,0 +1,77 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# UFO Question \n", + "\n", + "Our data science team has predicted that the Earth is going to be invaded by an alien force in the\n", + "next years. Our only hope is to replicate a device that can block all alien technology in a radius of\n", + "~300km. Sadly, the device was sold in 2004 to an anonymous buyer to protect her hometown and\n", + "we don't know how contact her again. We know that the device has been active since 2004 in one\n", + "city in the USA, and we want to know where to start our search.\n", + "We've included a dataset called ​ufo.csv​. This dataset contains over 80,000 reports of UFO sightings\n", + "over the last century (all of them verified by the ESA). Using this dataset, try to guess the city in\n", + "which the device has been hidden.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Import data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Select data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Find the city" + ] + } + ], + "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.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/ufos.ipynb b/ufos.ipynb index f539d1a..4992ba6 100755 --- a/ufos.ipynb +++ b/ufos.ipynb @@ -69,7 +69,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.2" } }, "nbformat": 4, From 73d33fc223e407140abc5627660b60518c0bb71b Mon Sep 17 00:00:00 2001 From: Atefeh Hezavehei Date: Sun, 30 May 2021 12:09:43 +0200 Subject: [PATCH 2/3] . --- .ipynb_checkpoints/ufos-checkpoint.ipynb | 84 +++++++++++++++++++++--- ufos.ipynb | 84 +++++++++++++++++++++--- 2 files changed, 152 insertions(+), 16 deletions(-) diff --git a/.ipynb_checkpoints/ufos-checkpoint.ipynb b/.ipynb_checkpoints/ufos-checkpoint.ipynb index 4992ba6..c87128a 100644 --- a/.ipynb_checkpoints/ufos-checkpoint.ipynb +++ b/.ipynb_checkpoints/ufos-checkpoint.ipynb @@ -18,38 +18,106 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting folium\n", + " Downloading folium-0.12.1-py2.py3-none-any.whl (94 kB)\n", + "Requirement already satisfied: numpy in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from folium) (1.20.2)\n", + "Requirement already satisfied: jinja2>=2.9 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from folium) (2.11.3)\n", + "Collecting branca>=0.3.0\n", + " Downloading branca-0.4.2-py3-none-any.whl (24 kB)\n", + "Requirement already satisfied: requests in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from folium) (2.25.1)\n", + "Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from jinja2>=2.9->folium) (1.1.1)\n", + "Requirement already satisfied: idna<3,>=2.5 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (2.10)\n", + "Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (1.26.4)\n", + "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (2020.12.5)\n", + "Requirement already satisfied: chardet<5,>=3.0.2 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (4.0.0)\n", + "Installing collected packages: branca, folium\n", + "Successfully installed branca-0.4.2 folium-0.12.1\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.\n", + "You should consider upgrading via the 'c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\python.exe -m pip install --upgrade pip' command.\n" + ] + } + ], + "source": [ + "!pip install folium" + ] + }, + { + "cell_type": "code", + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ - "# Import libraries" + "# Import libraries\n", + "import pandas as pd\n", + "import folium\n", + "from folium import plugins" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "# Import data" + "# Import data\n", + "ufo=pd.read_csv(\"ufo.csv\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ - "# Select data" + "# Select data\n", + "filtered=ufo[(ufo[\"country\"]==\"us\") & (ufo[\"year\"] >= 2004)]" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Create a map\n", + "mapa =folium.Map([40.732029, -73.988129], zoom_start=11)\n", + "mapa" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ - "# Find the city" + "# Find the city\n" ] } ], diff --git a/ufos.ipynb b/ufos.ipynb index 4992ba6..c87128a 100755 --- a/ufos.ipynb +++ b/ufos.ipynb @@ -18,38 +18,106 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting folium\n", + " Downloading folium-0.12.1-py2.py3-none-any.whl (94 kB)\n", + "Requirement already satisfied: numpy in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from folium) (1.20.2)\n", + "Requirement already satisfied: jinja2>=2.9 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from folium) (2.11.3)\n", + "Collecting branca>=0.3.0\n", + " Downloading branca-0.4.2-py3-none-any.whl (24 kB)\n", + "Requirement already satisfied: requests in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from folium) (2.25.1)\n", + "Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from jinja2>=2.9->folium) (1.1.1)\n", + "Requirement already satisfied: idna<3,>=2.5 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (2.10)\n", + "Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (1.26.4)\n", + "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (2020.12.5)\n", + "Requirement already satisfied: chardet<5,>=3.0.2 in c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\lib\\site-packages (from requests->folium) (4.0.0)\n", + "Installing collected packages: branca, folium\n", + "Successfully installed branca-0.4.2 folium-0.12.1\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.\n", + "You should consider upgrading via the 'c:\\users\\atefe\\appdata\\local\\programs\\python\\python39\\python.exe -m pip install --upgrade pip' command.\n" + ] + } + ], + "source": [ + "!pip install folium" + ] + }, + { + "cell_type": "code", + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ - "# Import libraries" + "# Import libraries\n", + "import pandas as pd\n", + "import folium\n", + "from folium import plugins" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "# Import data" + "# Import data\n", + "ufo=pd.read_csv(\"ufo.csv\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ - "# Select data" + "# Select data\n", + "filtered=ufo[(ufo[\"country\"]==\"us\") & (ufo[\"year\"] >= 2004)]" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Create a map\n", + "mapa =folium.Map([40.732029, -73.988129], zoom_start=11)\n", + "mapa" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ - "# Find the city" + "# Find the city\n" ] } ], From 410c5d94e29aee52881c15d1b243953f8af39f75 Mon Sep 17 00:00:00 2001 From: Atefeh Hezavehei Date: Sun, 30 May 2021 12:19:40 +0200 Subject: [PATCH 3/3] hecho --- .ipynb_checkpoints/ufos-checkpoint.ipynb | 31 +++++++++++++++--------- ufos.ipynb | 31 +++++++++++++++--------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/.ipynb_checkpoints/ufos-checkpoint.ipynb b/.ipynb_checkpoints/ufos-checkpoint.ipynb index c87128a..a61e327 100644 --- a/.ipynb_checkpoints/ufos-checkpoint.ipynb +++ b/.ipynb_checkpoints/ufos-checkpoint.ipynb @@ -78,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -88,37 +88,46 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "# Create a map\n", + "mapa =folium.Map([40.732029, -73.988129], zoom_start=11)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ - "" + "" ] }, - "execution_count": 13, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# Create a map\n", - "mapa =folium.Map([40.732029, -73.988129], zoom_start=11)\n", + "# Find the city\n", + "cites = filtered[['latitude', 'longitude']].values\n", + "mapa.add_child(folium.plugins.HeatMap(cites, radius=15))\n", "mapa" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "# Find the city\n" - ] + "source": [] } ], "metadata": { diff --git a/ufos.ipynb b/ufos.ipynb index c87128a..a61e327 100755 --- a/ufos.ipynb +++ b/ufos.ipynb @@ -78,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -88,37 +88,46 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "# Create a map\n", + "mapa =folium.Map([40.732029, -73.988129], zoom_start=11)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ - "" + "" ] }, - "execution_count": 13, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# Create a map\n", - "mapa =folium.Map([40.732029, -73.988129], zoom_start=11)\n", + "# Find the city\n", + "cites = filtered[['latitude', 'longitude']].values\n", + "mapa.add_child(folium.plugins.HeatMap(cites, radius=15))\n", "mapa" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "# Find the city\n" - ] + "source": [] } ], "metadata": {