{ "cells": [ { "cell_type": "markdown", "id": "ba251f66", "metadata": { "papermill": { "duration": 0.011825, "end_time": "2021-12-14T18:23:27.026491", "exception": false, "start_time": "2021-12-14T18:23:27.014666", "status": "completed" }, "tags": [] }, "source": [ "In this notebook, we're going to work with dates.\n", "\n", "Let's get started!" ] }, { "cell_type": "markdown", "id": "b174b798", "metadata": { "papermill": { "duration": 0.009886, "end_time": "2021-12-14T18:23:27.046876", "exception": false, "start_time": "2021-12-14T18:23:27.036990", "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": "e77eb61e", "metadata": { "execution": { "iopub.execute_input": "2021-12-14T18:23:27.072817Z", "iopub.status.busy": "2021-12-14T18:23:27.071220Z", "iopub.status.idle": "2021-12-14T18:23:28.096759Z", "shell.execute_reply": "2021-12-14T18:23:28.096113Z" }, "papermill": { "duration": 1.039951, "end_time": "2021-12-14T18:23:28.096920", "exception": false, "start_time": "2021-12-14T18:23:27.056969", "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": "c2c6d76e", "metadata": { "papermill": { "duration": 0.010572, "end_time": "2021-12-14T18:23:28.117984", "exception": false, "start_time": "2021-12-14T18:23:28.107412", "status": "completed" }, "tags": [] }, "source": [ "Now we're ready to look at some dates!" ] }, { "cell_type": "markdown", "id": "79463dfa", "metadata": { "papermill": { "duration": 0.010058, "end_time": "2021-12-14T18:23:28.138449", "exception": false, "start_time": "2021-12-14T18:23:28.128391", "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": "5f70f1ea", "metadata": { "execution": { "iopub.execute_input": "2021-12-14T18:23:28.161611Z", "iopub.status.busy": "2021-12-14T18:23:28.161074Z", "iopub.status.idle": "2021-12-14T18:23:28.192867Z", "shell.execute_reply": "2021-12-14T18:23:28.193320Z" }, "papermill": { "duration": 0.044865, "end_time": "2021-12-14T18:23:28.193493", "exception": false, "start_time": "2021-12-14T18:23:28.148628", "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", "