{ "cells": [ { "cell_type": "markdown", "id": "characteristic-experiment", "metadata": { "papermill": { "duration": 0.010516, "end_time": "2021-06-03T16:37:54.066551", "exception": false, "start_time": "2021-06-03T16:37:54.056035", "status": "completed" }, "tags": [] }, "source": [ "In this notebook, we're going to work with dates.\n", "\n", "Let's get started!" ] }, { "cell_type": "markdown", "id": "domestic-renaissance", "metadata": { "papermill": { "duration": 0.009162, "end_time": "2021-06-03T16:37:54.085438", "exception": false, "start_time": "2021-06-03T16:37:54.076276", "status": "completed" }, "tags": [] }, "source": [ "# Get our environment set up\n", "\n", "The first thing we'll need to do is load in the libraries and dataset we'll be using. We'll be working with a dataset that contains information on landslides that occured between 2007 and 2016. In the [**following exercise**](https://www.kaggle.com/kernels/fork/10824403), you'll apply your new skills to a dataset of worldwide earthquakes." ] }, { "cell_type": "code", "execution_count": 1, "id": "available-imaging", "metadata": { "execution": { "iopub.execute_input": "2021-06-03T16:37:54.107790Z", "iopub.status.busy": "2021-06-03T16:37:54.106875Z", "iopub.status.idle": "2021-06-03T16:37:54.948885Z", "shell.execute_reply": "2021-06-03T16:37:54.948231Z" }, "papermill": { "duration": 0.854261, "end_time": "2021-06-03T16:37:54.949074", "exception": false, "start_time": "2021-06-03T16:37:54.094813", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# modules we'll use\n", "import pandas as pd\n", "import numpy as np\n", "import seaborn as sns\n", "import datetime\n", "\n", "# read in our data\n", "landslides = pd.read_csv(\"../input/landslide-events/catalog.csv\")\n", "\n", "# set seed for reproducibility\n", "np.random.seed(0)" ] }, { "cell_type": "markdown", "id": "federal-eating", "metadata": { "papermill": { "duration": 0.0093, "end_time": "2021-06-03T16:37:54.968213", "exception": false, "start_time": "2021-06-03T16:37:54.958913", "status": "completed" }, "tags": [] }, "source": [ "Now we're ready to look at some dates!" ] }, { "cell_type": "markdown", "id": "helpful-latitude", "metadata": { "papermill": { "duration": 0.009276, "end_time": "2021-06-03T16:37:54.986991", "exception": false, "start_time": "2021-06-03T16:37:54.977715", "status": "completed" }, "tags": [] }, "source": [ "# Check the data type of our date column\n", "\n", "We begin by taking a look at the first five rows of the data." ] }, { "cell_type": "code", "execution_count": 2, "id": "animated-serbia", "metadata": { "execution": { "iopub.execute_input": "2021-06-03T16:37:55.023394Z", "iopub.status.busy": "2021-06-03T16:37:55.016182Z", "iopub.status.idle": "2021-06-03T16:37:55.048425Z", "shell.execute_reply": "2021-06-03T16:37:55.047977Z" }, "papermill": { "duration": 0.052002, "end_time": "2021-06-03T16:37:55.048544", "exception": false, "start_time": "2021-06-03T16:37:54.996542", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " | id | \n", "date | \n", "time | \n", "continent_code | \n", "country_name | \n", "country_code | \n", "state/province | \n", "population | \n", "city/town | \n", "distance | \n", "... | \n", "geolocation | \n", "hazard_type | \n", "landslide_type | \n", "landslide_size | \n", "trigger | \n", "storm_name | \n", "injuries | \n", "fatalities | \n", "source_name | \n", "source_link | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "34 | \n", "3/2/07 | \n", "Night | \n", "NaN | \n", "United States | \n", "US | \n", "Virginia | \n", "16000 | \n", "Cherry Hill | \n", "3.40765 | \n", "... | \n", "(38.600900000000003, -77.268199999999993) | \n", "Landslide | \n", "Landslide | \n", "Small | \n", "Rain | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NBC 4 news | \n", "http://www.nbc4.com/news/11186871/detail.html | \n", "
1 | \n", "42 | \n", "3/22/07 | \n", "NaN | \n", "NaN | \n", "United States | \n", "US | \n", "Ohio | \n", "17288 | \n", "New Philadelphia | \n", "3.33522 | \n", "... | \n", "(40.517499999999998, -81.430499999999995) | \n", "Landslide | \n", "Landslide | \n", "Small | \n", "Rain | \n", "NaN | \n", "NaN | \n", "NaN | \n", "Canton Rep.com | \n", "http://www.cantonrep.com/index.php?ID=345054&C... | \n", "
2 | \n", "56 | \n", "4/6/07 | \n", "NaN | \n", "NaN | \n", "United States | \n", "US | \n", "Pennsylvania | \n", "15930 | \n", "Wilkinsburg | \n", "2.91977 | \n", "... | \n", "(40.4377, -79.915999999999997) | \n", "Landslide | \n", "Landslide | \n", "Small | \n", "Rain | \n", "NaN | \n", "NaN | \n", "NaN | \n", "The Pittsburgh Channel.com | \n", "https://web.archive.org/web/20080423132842/htt... | \n", "
3 | \n", "59 | \n", "4/14/07 | \n", "NaN | \n", "NaN | \n", "Canada | \n", "CA | \n", "Quebec | \n", "42786 | \n", "Châteauguay | \n", "2.98682 | \n", "... | \n", "(45.322600000000001, -73.777100000000004) | \n", "Landslide | \n", "Riverbank collapse | \n", "Small | \n", "Rain | \n", "NaN | \n", "NaN | \n", "NaN | \n", "Le Soleil | \n", "http://www.hebdos.net/lsc/edition162007/articl... | \n", "
4 | \n", "61 | \n", "4/15/07 | \n", "NaN | \n", "NaN | \n", "United States | \n", "US | \n", "Kentucky | \n", "6903 | \n", "Pikeville | \n", "5.66542 | \n", "... | \n", "(37.432499999999997, -82.493099999999998) | \n", "Landslide | \n", "Landslide | \n", "Small | \n", "Downpour | \n", "NaN | \n", "NaN | \n", "0.0 | \n", "Matthew Crawford (KGS) | \n", "NaN | \n", "
5 rows × 23 columns
\n", "