{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# UFO dataset -> making a dashboard" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# usual things\n", "import pandas as pd\n", "import bqplot\n", "import numpy as np\n", "import ipywidgets\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "ufos = pd.read_csv(\"/Users/jillnaiman/Downloads/ufo-scrubbed-geocoded-time-standardized-00.csv\",\n", " names = [\"date\", \"city\", \"state\", \"country\",\n", " \"shape\", \"duration_seconds\", \"duration\",\n", " \"comment\", \"report_date\", \n", " \"latitude\", \"longitude\"],\n", " parse_dates = [\"date\", \"report_date\"])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "80332" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(ufos)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "# downsampling if you want to:\n", "nsamples = 1000 # 100, 5000\n", "downSampleMask = np.random.choice(range(len(ufos)-1), nsamples, replace=False)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "#downSampleMask\n", "ufosDS = ufos.loc[downSampleMask]" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | date | \n", "city | \n", "state | \n", "country | \n", "shape | \n", "duration_seconds | \n", "duration | \n", "comment | \n", "report_date | \n", "latitude | \n", "longitude | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|
11213 | \n", "2011-01-01 00:00:00 | \n", "farmington hills | \n", "mi | \n", "us | \n", "circle | \n", "900.0 | \n", "appx. 15 mins | \n", "Series of red lights moving in a wave-like line. | \n", "2011-01-05 | \n", "42.485278 | \n", "-83.377222 | \n", "
28294 | \n", "2013-02-23 18:57:00 | \n", "whittier | \n", "ca | \n", "us | \n", "circle | \n", "300.0 | \n", "3-5 minutes | \n", "13 to 15 bright reddish/orange orb shaped obje... | \n", "2013-02-28 | \n", "33.979167 | \n", "-118.031944 | \n", "
25409 | \n", "2006-01-09 18:53:00 | \n", "el segundo | \n", "ca | \n", "us | \n", "fireball | \n", "10.0 | \n", "10 sec | \n", "Rotating fire ball moving very fast, few hu... | \n", "2006-02-14 | \n", "33.919167 | \n", "-118.415556 | \n", "
20276 | \n", "2010-12-24 20:00:00 | \n", "cherry fork | \n", "oh | \n", "us | \n", "light | \n", "300.0 | \n", "5 min | \n", "Three red lights in triangle formation no soun... | \n", "2011-04-03 | \n", "38.887500 | \n", "-83.614444 | \n", "
7783 | \n", "2010-11-10 21:00:00 | \n", "spruce pine | \n", "nc | \n", "us | \n", "triangle | \n", "3600.0 | \n", "1 hour | \n", "Red and Yellow Prisms in the Sky over Appalachia | \n", "2012-05-13 | \n", "35.915278 | \n", "-82.064722 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
11400 | \n", "2014-01-01 00:00:00 | \n", "kettering | \n", "oh | \n", "us | \n", "circle | \n", "45.0 | \n", "45 seconds | \n", "Strange orange ball. | \n", "2014-01-10 | \n", "39.689444 | \n", "-84.168889 | \n", "
16889 | \n", "1998-12-10 01:15:00 | \n", "camp pendelton | \n", "ca | \n", "NaN | \n", "sphere | \n", "109800.0 | \n", "3 1/2 hrs | \n", "Blue Sphere | \n", "2005-05-24 | \n", "33.317842 | \n", "-117.320512 | \n", "
68557 | \n", "2002-08-02 22:30:00 | \n", "camarillo | \n", "ca | \n", "us | \n", "other | \n", "15.0 | \n", "15 seconds | \n", "Unbelievable craft observed at low altitude ov... | \n", "2013-04-12 | \n", "34.216389 | \n", "-119.036667 | \n", "
52232 | \n", "2000-06-28 01:00:00 | \n", "newmarket | \n", "nh | \n", "us | \n", "oval | \n", "300.0 | \n", "aprox.5min. | \n", "Black oval w/ multi-colored lights a frighteni... | \n", "2000-08-25 | \n", "43.082778 | \n", "-70.935556 | \n", "
63402 | \n", "1998-07-07 22:00:00 | \n", "hull | \n", "ga | \n", "us | \n", "oval | \n", "300.0 | \n", "five minutes | \n", "small, luminous, silent, gliding craft | \n", "2007-06-12 | \n", "34.014722 | \n", "-83.293889 | \n", "
1000 rows × 11 columns
\n", "