diff --git a/.ipynb_checkpoints/ufos-checkpoint.ipynb b/.ipynb_checkpoints/ufos-checkpoint.ipynb new file mode 100644 index 0000000..a61e327 --- /dev/null +++ b/.ipynb_checkpoints/ufos-checkpoint.ipynb @@ -0,0 +1,154 @@ +{ + "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": 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\n", + "import pandas as pd\n", + "import folium\n", + "from folium import plugins" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# Import data\n", + "ufo=pd.read_csv(\"ufo.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [], + "source": [ + "# Select data\n", + "filtered=ufo[(ufo[\"country\"]==\"us\") & (ufo[\"year\"] >= 2004)]" + ] + }, + { + "cell_type": "code", + "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": [ + "