{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Untitled84.ipynb", "provenance": [], "authorship_tag": "ABX9TyOGtzvJ0UZ3UM4iTfySCDHz", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "source": [ "# Dates" ], "metadata": { "id": "HoHHAFoHQoeg" } }, { "cell_type": "markdown", "source": [ "## Converting Seperate Columns into Datetime" ], "metadata": { "id": "rkKRZejlQsB8" } }, { "cell_type": "markdown", "source": [ "I gathered the folloiwng dataset from [this paper](https://www.sciencedirect.com/science/article/pii/S2352340918315191). It looks at actual hotel stays and reservations. It is interesting because it has dates in several formats." ], "metadata": { "id": "W9-rSXCxQ2pq" } }, { "cell_type": "code", "execution_count": 1, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "id": "8udT7ow6QntB", "outputId": "cf108c79-2cc7-4284-e0ec-44ca2687195d" }, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "\n", "
\n", "
\n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
01234567891011121314
IsCanceled000000001110000
LeadTime34273771314140985752335681837
ArrivalDateYear201520152015201520152015201520152015201520152015201520152015
ArrivalDateMonthJulyJulyJulyJulyJulyJulyJulyJulyJulyJulyJulyJulyJulyJulyJuly
ArrivalDateWeekNumber272727272727272727272727272727
ArrivalDateDayOfMonth111111111111111
StaysInWeekendNights000000000000000
StaysInWeekNights001122223344444
Adults221122222222222
Children000000000000010
Babies000000000000000
MealBBBBBBBBBBBBBBFBBBHBBBHBBBHBBB
CountryPRTPRTGBRGBRGBRGBRPRTPRTPRTPRTPRTPRTUSAESPPRT
MarketSegmentDirectDirectDirectCorporateOnline TAOnline TADirectDirectOnline TAOffline TA/TOOnline TAOnline TAOnline TAOnline TAOnline TA
DistributionChannelDirectDirectDirectCorporateTA/TOTA/TODirectDirectTA/TOTA/TOTA/TOTA/TOTA/TOTA/TOTA/TO
IsRepeatedGuest000000000000000
PreviousCancellations000000000000000
PreviousBookingsNotCanceled000000000000000
ReservedRoomTypeCCAAAACCADEDDGE
AssignedRoomTypeCCCAAACCADEDEGE
BookingChanges340000000000010
DepositTypeNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo DepositNo Deposit
AgentNULLNULLNULL304240240NULL30324015240240240241241
CompanyNULLNULLNULLNULLNULLNULLNULLNULLNULLNULLNULLNULLNULLNULLNULL
DaysInWaitingList000000000000000
CustomerTypeTransientTransientTransientTransientTransientTransientTransientTransientTransientTransientTransientTransientTransientTransientTransient
ADR0.00.075.075.098.098.0107.0103.082.0105.5123.0145.097.0154.7794.71
RequiredCarParkingSpaces000000000000000
TotalOfSpecialRequests000011011000310
ReservationStatusCheck-OutCheck-OutCheck-OutCheck-OutCheck-OutCheck-OutCheck-OutCheck-OutCanceledCanceledCanceledCheck-OutCheck-OutCheck-OutCheck-Out
ReservationStatusDate7/1/20157/1/20157/2/20157/2/20157/3/20157/3/20157/3/20157/3/20155/6/20154/22/20156/23/20157/5/20157/5/20157/5/20157/5/2015
\n", "
\n", " \n", " \n", " \n", "\n", " \n", "
\n", "
\n", " " ], "text/plain": [ " 0 ... 14\n", "IsCanceled 0 ... 0\n", "LeadTime 342 ... 37\n", "ArrivalDateYear 2015 ... 2015\n", "ArrivalDateMonth July ... July\n", "ArrivalDateWeekNumber 27 ... 27\n", "ArrivalDateDayOfMonth 1 ... 1\n", "StaysInWeekendNights 0 ... 0\n", "StaysInWeekNights 0 ... 4\n", "Adults 2 ... 2\n", "Children 0 ... 0\n", "Babies 0 ... 0\n", "Meal BB ... BB \n", "Country PRT ... PRT\n", "MarketSegment Direct ... Online TA\n", "DistributionChannel Direct ... TA/TO\n", "IsRepeatedGuest 0 ... 0\n", "PreviousCancellations 0 ... 0\n", "PreviousBookingsNotCanceled 0 ... 0\n", "ReservedRoomType C ... E \n", "AssignedRoomType C ... E \n", "BookingChanges 3 ... 0\n", "DepositType No Deposit ... No Deposit \n", "Agent NULL ... 241\n", "Company NULL ... NULL\n", "DaysInWaitingList 0 ... 0\n", "CustomerType Transient ... Transient\n", "ADR 0.0 ... 94.71\n", "RequiredCarParkingSpaces 0 ... 0\n", "TotalOfSpecialRequests 0 ... 0\n", "ReservationStatus Check-Out ... Check-Out\n", "ReservationStatusDate 7/1/2015 ... 7/5/2015\n", "\n", "[31 rows x 15 columns]" ] }, "metadata": {}, "execution_count": 1 } ], "source": [ "import pandas as pa\n", "\n", "df = pa.read_csv('https://raw.githubusercontent.com/nurfnick/Data_Viz/main/H1.csv')\n", "\n", "df.head(15).T" ] }, { "cell_type": "code", "source": [ "df.dtypes" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "rPU7QYrFRUgi", "outputId": "4cd1eb2e-8875-4eb3-aa73-c9073086bf8a" }, "execution_count": 2, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "IsCanceled int64\n", "LeadTime int64\n", "ArrivalDateYear int64\n", "ArrivalDateMonth object\n", "ArrivalDateWeekNumber int64\n", "ArrivalDateDayOfMonth int64\n", "StaysInWeekendNights int64\n", "StaysInWeekNights int64\n", "Adults int64\n", "Children int64\n", "Babies int64\n", "Meal object\n", "Country object\n", "MarketSegment object\n", "DistributionChannel object\n", "IsRepeatedGuest int64\n", "PreviousCancellations int64\n", "PreviousBookingsNotCanceled int64\n", "ReservedRoomType object\n", "AssignedRoomType object\n", "BookingChanges int64\n", "DepositType object\n", "Agent object\n", "Company object\n", "DaysInWaitingList int64\n", "CustomerType object\n", "ADR float64\n", "RequiredCarParkingSpaces int64\n", "TotalOfSpecialRequests int64\n", "ReservationStatus object\n", "ReservationStatusDate object\n", "dtype: object" ] }, "metadata": {}, "execution_count": 2 } ] }, { "cell_type": "markdown", "source": [ "We can see nothing has been interpreted as a date yet! Let's grab the low hanging fruit and convert the *ReservationStatusDate* into datetime. I'll have to give it the correct format of the date. In this case it is in the Month/Day/Year. " ], "metadata": { "id": "_ys8PNd1RyA-" } }, { "cell_type": "code", "source": [ "pa.to_datetime(df.ReservationStatusDate, format='%m/%d/%Y')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Y6qgtjMZRvNC", "outputId": "9a513dc9-bc73-4113-d7a3-75cecae85d89" }, "execution_count": 3, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 2015-07-01\n", "1 2015-07-01\n", "2 2015-07-02\n", "3 2015-07-02\n", "4 2015-07-03\n", " ... \n", "40055 2017-09-10\n", "40056 2017-09-10\n", "40057 2017-09-12\n", "40058 2017-09-14\n", "40059 2017-09-14\n", "Name: ReservationStatusDate, Length: 40060, dtype: datetime64[ns]" ] }, "metadata": {}, "execution_count": 3 } ] }, { "cell_type": "markdown", "source": [ "I'll add that to the dataframe converting it's current column." ], "metadata": { "id": "lsAP9K02U2eT" } }, { "cell_type": "code", "source": [ "df.ReservationStatusDate = pa.to_datetime(df.ReservationStatusDate, format='%m/%d/%Y')" ], "metadata": { "id": "8StfJObFU9fj" }, "execution_count": 4, "outputs": [] }, { "cell_type": "markdown", "source": [ "If I'd like to do is get the Arrival Date into a date format. To do that I'll first convert the month into a numeric using a dictionary." ], "metadata": { "id": "z3wtZ2z7RYRp" } }, { "cell_type": "code", "source": [ "df.ArrivalDateMonth.unique()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YLiRGoPbT2CE", "outputId": "8c27242f-6a44-4a09-b37a-522f273e0ef3" }, "execution_count": 5, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "array(['July', 'August', 'September', 'October', 'November', 'December',\n", " 'January', 'February', 'March', 'April', 'May', 'June'],\n", " dtype=object)" ] }, "metadata": {}, "execution_count": 5 } ] }, { "cell_type": "code", "source": [ "monthConvert = {\n", " 'January':1,\n", " 'February':2,\n", " 'March':3,\n", " 'April':4,\n", " 'May':5,\n", " 'June':6,\n", " 'July':7,\n", " 'August':8,\n", " 'September':9,\n", " 'October':10,\n", " 'November':11,\n", " 'December':12\n", "}" ], "metadata": { "id": "SME0iJRCTrfa" }, "execution_count": 6, "outputs": [] }, { "cell_type": "code", "source": [ "df.ArrivalDateMonth.apply(lambda s: monthConvert[s])" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "781IFCioUUxq", "outputId": "495ea460-3ea6-4ad2-e5ff-f55e87cd41c9" }, "execution_count": 7, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 7\n", "1 7\n", "2 7\n", "3 7\n", "4 7\n", " ..\n", "40055 8\n", "40056 8\n", "40057 8\n", "40058 8\n", "40059 8\n", "Name: ArrivalDateMonth, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 7 } ] }, { "cell_type": "code", "source": [ "df['ArrivalDate'] = pa.to_datetime(dict(year = df.ArrivalDateYear, month = df.ArrivalDateMonth.apply(lambda s: monthConvert[s]), day = df.ArrivalDateDayOfMonth))\n", "\n", "df.dtypes" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Z8l2W19MSMia", "outputId": "e2263e63-8309-4fd0-d82c-92141b78a10e" }, "execution_count": 8, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "IsCanceled int64\n", "LeadTime int64\n", "ArrivalDateYear int64\n", "ArrivalDateMonth object\n", "ArrivalDateWeekNumber int64\n", "ArrivalDateDayOfMonth int64\n", "StaysInWeekendNights int64\n", "StaysInWeekNights int64\n", "Adults int64\n", "Children int64\n", "Babies int64\n", "Meal object\n", "Country object\n", "MarketSegment object\n", "DistributionChannel object\n", "IsRepeatedGuest int64\n", "PreviousCancellations int64\n", "PreviousBookingsNotCanceled int64\n", "ReservedRoomType object\n", "AssignedRoomType object\n", "BookingChanges int64\n", "DepositType object\n", "Agent object\n", "Company object\n", "DaysInWaitingList int64\n", "CustomerType object\n", "ADR float64\n", "RequiredCarParkingSpaces int64\n", "TotalOfSpecialRequests int64\n", "ReservationStatus object\n", "ReservationStatusDate datetime64[ns]\n", "ArrivalDate datetime64[ns]\n", "dtype: object" ] }, "metadata": {}, "execution_count": 8 } ] }, { "cell_type": "markdown", "source": [ "## Date Differences" ], "metadata": { "id": "3pzV2R7Cae8l" } }, { "cell_type": "markdown", "source": [ "I am curious if these two dates have any differences..." ], "metadata": { "id": "ZUeUIg_pVFmS" } }, { "cell_type": "code", "source": [ "differenceInDates = df.ArrivalDate -df.ReservationStatusDate\n", "\n", "differenceInDates.describe()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "UdSOOo1nTCxI", "outputId": "1c23d482-3f84-4237-c73e-fa5c31f5c8d6" }, "execution_count": 9, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "count 40060\n", "mean 18 days 01:33:23.275087369\n", "std 54 days 20:29:21.893473870\n", "min -69 days +00:00:00\n", "25% -5 days +00:00:00\n", "50% -2 days +00:00:00\n", "75% 3 days 00:00:00\n", "max 411 days 00:00:00\n", "dtype: object" ] }, "metadata": {}, "execution_count": 9 } ] }, { "cell_type": "markdown", "source": [ "We see that on average people make their reservation about 18 days ahead of time and some more than a year! Not so sure what is going on with all the negative times...\n", "\n", "If graphed this in terms of days. Of course there are other options found [here](https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.datetime.html#datetime-units) " ], "metadata": { "id": "lyuWm5AwV14P" } }, { "cell_type": "code", "source": [ "differenceInDates.astype('timedelta64[D]').plot(kind = 'hist')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 283 }, "id": "n7Nsft43VU96", "outputId": "b6066b83-8511-4406-8a9c-374a3eee596a" }, "execution_count": 10, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 10 }, { "output_type": "display_data", "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAD4CAYAAAAtrdtxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAVaklEQVR4nO3df/BddX3n8efL8NNa5VeaZRJsUDN1Y6sRI6Rjd9bCCAG2BnepC9OWDMuYzhhmdNaZNbidQlV28I9Ky44ypZIxuGpAtCWr6bIRmTr9A0gQCgTK5ivCkhhJSgJo7UKh7/3jfr54G79JLofvvTfffJ+PmTP3nPf59fl8HfLynPO556aqkCSpi9eMuwGSpJnLEJEkdWaISJI6M0QkSZ0ZIpKkzo4YdwNG7aSTTqqFCxeOuxmSNKPce++9f19Vc/etz7oQWbhwIVu2bBl3MyRpRknyxFR1b2dJkjozRCRJnRkikqTODBFJUmeGiCSpM0NEktSZISJJ6swQkSR1ZohIkjqbdd9Yn4kWrvnW2M79+DXnj+3ckg59XolIkjozRCRJnRkikqTODBFJUmeGiCSpM0NEktSZISJJ6swQkSR1ZohIkjozRCRJnRkikqTODBFJUmeGiCSps6GFSJJjktyT5G+TbE3yR61+apK7k0wkuTnJUa1+dFueaOsX9h3rilZ/NMk5ffXlrTaRZM2w+iJJmtowr0SeB86sqncAS4DlSZYBnwGuraq3AHuBy9r2lwF7W/3ath1JFgMXAW8DlgOfTzInyRzgc8C5wGLg4ratJGlEhhYi1fOTtnhkmwo4E7i11dcBF7T5FW2Ztv6sJGn19VX1fFX9AJgATm/TRFU9VlUvAOvbtpKkERnqM5F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r7Lvv0HvVtUDwP1tOm829B94O3Bf6/tDwB+2+puAe4AJ4GvA0a1+TFueaOvfNO4+TNPf4b3ANw+FvvvaE0lSZ97OkiR1ZohIkjozRCRJnRkikqTODBFJUmeGiCSpM0NEktTZ/wfkYaT1TUcTOwAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "code", "source": [ "differenceInDates.astype('timedelta64[D]').plot.box()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 283 }, "id": "yd490bEwWKho", "outputId": "bd8411e5-dd93-438e-ae75-eb37fb91d62f" }, "execution_count": 11, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": {}, "execution_count": 11 }, { "output_type": "display_data", "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAPdUlEQVR4nO3dfWxdd33H8ffXiXEjYHZJvaqK2xqplUgqxsOsrilTlFKF8KQ1QlA1Q9Ayq2lo1rLRLiTpHwxpdEUiK0tF3UUrI0Gs0ME0EFRqosZoixgZLg9lNBp4VaM6AmqaJ1ZwyMN3f/gkci5OfB375to/v1+Sdc/5/s6952up/fjkd3/33MhMJEllaWl2A5Kk6We4S1KBDHdJKpDhLkkFMtwlqUDzm90AwCWXXJLd3d3NbkOSZpWnn376l5nZOd7YjAj37u5uBgYGmt2GJM0qEbHvbGNOy0hSgQx3SSqQ4S5JBTLcJalAhrskFWhGrJaRZpqI+J2aN9nTbOKVu1RjbLBv2bJl3Lo00xnu0lm0tbVx991309bW1uxWpEkz3KWzuP/++3n55Ze5//77m92KNGkxE+YRe3p60k+oaqY4Nf3S1tbG0aNHTz+C8+6aWSLi6cz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MzvEGZkS4SzNVRAycbamZNJM5LSNJBTLcJalAhrt0blub3YB0Ppxzl6QCeeUuSQUy3CWpQIa75pSIyIjYPGb/3oj46ya2JDWE4a655ijwnoi4pNmNSI1kuGuuOc7oCpi/rB2IiO6I2BURz0TEUxFxRVX/fERsiYhvR8RzEfHeMc/5q4j4bvWcT1y4X0M6N8Ndc9FngfdHRHtN/SFgW2b+AfBFYMuYscuAPwbeDTwAEBFvA64GrgXeCPxhRCxrcO9SXQx3zTmZeQTYDtxdM7QU+Odq+wuMhvkp/5aZJzPzWeDSqva26uf7wPeA1zEa9lLT+R2qmqs+w2gg/1Odxx8dsx1jHv82M/9hOhuTpoNX7pqTMvMA8DjQO6b8beCWavv9wH9M8DJPAn8WEa8CiIhFEfH7092rdD4Md81lmxm9pe8pdwEfiohngA8AHznXkzNzB6PTOP8ZET8CvgK8ukG9SpPi7QckqUBeuUtSgQx3SSqQ4S5JBTLcJalAhrskFchwl6QCGe6SVKD/B06L+kuZ7/TKAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" } } ] }, { "cell_type": "markdown", "source": [ "## Extracting Peices" ], "metadata": { "id": "H70UmwDxaa-H" } }, { "cell_type": "markdown", "source": [ "What if we wanted to get the day from the datetime? To get it you'll need to convert it to `datetime` it is shortened to `dt` here." ], "metadata": { "id": "xs3kwX0lai0k" } }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.day" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "jFOjFxblW4ZP", "outputId": "2cd7a967-050c-48db-9221-4acd32122e6e" }, "execution_count": 12, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 1\n", "1 1\n", "2 1\n", "3 1\n", "4 1\n", " ..\n", "40055 31\n", "40056 30\n", "40057 29\n", "40058 31\n", "40059 31\n", "Name: ArrivalDate, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 12 } ] }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.week" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "fNtQ2EwVap_u", "outputId": "993da0db-a5ad-4937-f90b-3edf4316ebf7" }, "execution_count": 13, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:1: FutureWarning: Series.dt.weekofyear and Series.dt.week have been deprecated. Please use Series.dt.isocalendar().week instead.\n", " \"\"\"Entry point for launching an IPython kernel.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "0 27\n", "1 27\n", "2 27\n", "3 27\n", "4 27\n", " ..\n", "40055 35\n", "40056 35\n", "40057 35\n", "40058 35\n", "40059 35\n", "Name: ArrivalDate, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 13 } ] }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.year" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "kVJESIpVbbJl", "outputId": "e643bf4b-b876-4fcc-c1c1-be4b2af89209" }, "execution_count": 14, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 2015\n", "1 2015\n", "2 2015\n", "3 2015\n", "4 2015\n", " ... \n", "40055 2017\n", "40056 2017\n", "40057 2017\n", "40058 2017\n", "40059 2017\n", "Name: ArrivalDate, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 14 } ] }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.month" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "cI0ptMC8jzej", "outputId": "1c8fdd7b-014c-4b7a-c545-73a0e6868298" }, "execution_count": 15, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 7\n", "1 7\n", "2 7\n", "3 7\n", "4 7\n", " ..\n", "40055 8\n", "40056 8\n", "40057 8\n", "40058 8\n", "40059 8\n", "Name: ArrivalDate, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 15 } ] }, { "cell_type": "markdown", "source": [ "We could also ask what day of the week it was." ], "metadata": { "id": "fLb-J0wNj3f7" } }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.dayofweek" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "iI1IMyKcj1RS", "outputId": "b1137a82-3e98-42d1-a50e-1e43f477f9f6" }, "execution_count": 16, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 2\n", "1 2\n", "2 2\n", "3 2\n", "4 2\n", " ..\n", "40055 3\n", "40056 2\n", "40057 1\n", "40058 3\n", "40059 3\n", "Name: ArrivalDate, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 16 } ] }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.day_name()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "s7k4a-PLj9AD", "outputId": "a455bbb2-f0c1-4850-b9de-a3f422476933" }, "execution_count": 17, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 Wednesday\n", "1 Wednesday\n", "2 Wednesday\n", "3 Wednesday\n", "4 Wednesday\n", " ... \n", "40055 Thursday\n", "40056 Wednesday\n", "40057 Tuesday\n", "40058 Thursday\n", "40059 Thursday\n", "Name: ArrivalDate, Length: 40060, dtype: object" ] }, "metadata": {}, "execution_count": 17 } ] }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.weekday" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "EreeSOIUkvSq", "outputId": "4a79ea13-7eaa-4132-db63-054f1bda82c7" }, "execution_count": 18, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 2\n", "1 2\n", "2 2\n", "3 2\n", "4 2\n", " ..\n", "40055 3\n", "40056 2\n", "40057 1\n", "40058 3\n", "40059 3\n", "Name: ArrivalDate, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 18 } ] }, { "cell_type": "markdown", "source": [ "The weekend is 5 and 6 for Saturday and Sunday so we can ask how many were then by the following" ], "metadata": { "id": "OQQFBQdmlNsQ" } }, { "cell_type": "code", "source": [ "df.ArrivalDate.dt.weekday[df.ArrivalDate.dt.weekday>4].count()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ZffdIcdHk8dc", "outputId": "be28690b-4340-45e3-b4fb-394e3fe845cc" }, "execution_count": 19, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "12009" ] }, "metadata": {}, "execution_count": 19 } ] }, { "cell_type": "markdown", "source": [ "We might wonder if that is an appropriate amount, it aappears to be about " ], "metadata": { "id": "0Zk31XqFlvWW" } }, { "cell_type": "code", "source": [ "12009/40060" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "4F1Ov_Ysl174", "outputId": "943bb6a6-047b-4de6-f112-f4f72716fd0f" }, "execution_count": 20, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0.29977533699450826" ] }, "metadata": {}, "execution_count": 20 } ] }, { "cell_type": "code", "source": [ "2/7" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "jNM1zbHWl5oQ", "outputId": "e89c983c-e4ad-4dd2-b0ad-cefcad0a1038" }, "execution_count": 21, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0.2857142857142857" ] }, "metadata": {}, "execution_count": 21 } ] }, { "cell_type": "markdown", "source": [ "Yeah thos proportions look similar but we'd have to do a hypothesis test to verify it statistically." ], "metadata": { "id": "LPIj0BqAl7ob" } }, { "cell_type": "markdown", "source": [ "## Numpy Can Handle Dates" ], "metadata": { "id": "L_YgM7VSaYIw" } }, { "cell_type": "markdown", "source": [ "Sometimes you might need to know several dates in a row. `Numpy` can handle that with `np.arange`." ], "metadata": { "id": "QWKh7JkGac7e" } }, { "cell_type": "code", "source": [ "import numpy as np\n", "\n", "np.arange('2018-01-01','2018-01-08', dtype='datetime64[D]')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Bu8M1BWxampV", "outputId": "f998b6f5-6899-4b45-c12c-d5bc1e9e722b" }, "execution_count": 22, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "array(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',\n", " '2018-01-05', '2018-01-06', '2018-01-07'], dtype='datetime64[D]')" ] }, "metadata": {}, "execution_count": 22 } ] }, { "cell_type": "code", "source": [ "pa.date_range(start='1/1/2018', end='1/08/2018')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "XvHV4oP5bDJF", "outputId": "b6647cc1-88a2-4a55-811b-c974f9ad079d" }, "execution_count": 23, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',\n", " '2018-01-05', '2018-01-06', '2018-01-07', '2018-01-08'],\n", " dtype='datetime64[ns]', freq='D')" ] }, "metadata": {}, "execution_count": 23 } ] }, { "cell_type": "markdown", "source": [ "Actually `pandas` did have a similar call and was less picky about the input style of the dates." ], "metadata": { "id": "c4-DAbwxbujC" } }, { "cell_type": "markdown", "source": [ "If you want to check for business days in a range, week days! Use `bdate_range`. We see the weekend was the 6th and 7th." ], "metadata": { "id": "yGT6dCLxbzRA" } }, { "cell_type": "code", "source": [ "pa.bdate_range(start='1/1/2018', end='1/08/2018')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "VscxXaj_co8X", "outputId": "4bbcb1f2-8d40-4eac-aaf5-0ef051195e01" }, "execution_count": 24, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04',\n", " '2018-01-05', '2018-01-08'],\n", " dtype='datetime64[ns]', freq='B')" ] }, "metadata": {}, "execution_count": 24 } ] }, { "cell_type": "markdown", "source": [ "## Lag For TimeSeries Data" ], "metadata": { "id": "Jqudi_6Rd8aV" } }, { "cell_type": "markdown", "source": [ "Sometimes our data is set in order in a time series and we are interested in knowing what came before it. To look at this we would use the [`shift` function.](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.shift.html) " ], "metadata": { "id": "GZlFRjaueDy9" } }, { "cell_type": "code", "source": [ "df.StaysInWeekendNights.shift()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "QoswzvZfewl4", "outputId": "dc978f25-5894-45d1-eb2e-a9209eeecbcd" }, "execution_count": 25, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 NaN\n", "1 0.0\n", "2 0.0\n", "3 0.0\n", "4 0.0\n", " ... \n", "40055 2.0\n", "40056 2.0\n", "40057 2.0\n", "40058 4.0\n", "40059 4.0\n", "Name: StaysInWeekendNights, Length: 40060, dtype: float64" ] }, "metadata": {}, "execution_count": 25 } ] }, { "cell_type": "markdown", "source": [ " We can then ask about the difference of those columns. I'll force the first to be filled with a zero." ], "metadata": { "id": "oQedFi5mfPhS" } }, { "cell_type": "code", "source": [ "df.StaysInWeekendNights.shift(fill_value=0)-df.StaysInWeekendNights" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "PkHze0pOfWX_", "outputId": "547bf7d0-8031-4f6b-89c2-d6a2fa30bf99" }, "execution_count": 26, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 0\n", "1 0\n", "2 0\n", "3 0\n", "4 0\n", " ..\n", "40055 0\n", "40056 0\n", "40057 -2\n", "40058 0\n", "40059 0\n", "Name: StaysInWeekendNights, Length: 40060, dtype: int64" ] }, "metadata": {}, "execution_count": 26 } ] }, { "cell_type": "markdown", "source": [ "This might be excellent for something like a moving average! My example is a 5 step moveing average but that can be changed easily." ], "metadata": { "id": "zT4lFkFsfk0A" } }, { "cell_type": "code", "source": [ "cols = df.StaysInWeekendNights" ], "metadata": { "id": "tOGljyARgky9" }, "execution_count": 27, "outputs": [] }, { "cell_type": "code", "source": [ "for i in range(1,5):\n", " cols += df.StaysInWeekendNights.shift(periods = i)\n", "\n", "cols/5" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "HTUvL0oSf0n2", "outputId": "b2cd3a30-5f65-4ef9-fa55-322170b3ab8c" }, "execution_count": 29, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 NaN\n", "1 NaN\n", "2 NaN\n", "3 NaN\n", "4 NaN\n", " ... \n", "40055 10.0\n", "40056 10.0\n", "40057 10.0\n", "40058 10.0\n", "40059 10.0\n", "Name: StaysInWeekendNights, Length: 40060, dtype: float64" ] }, "metadata": {}, "execution_count": 29 } ] }, { "cell_type": "markdown", "source": [ "I had some issues making this code do what I expected so be warry!" ], "metadata": { "id": "YcDzNFfIhSVV" } }, { "cell_type": "markdown", "source": [ "## Selecting Dates" ], "metadata": { "id": "qGrRFudh0rTj" } }, { "cell_type": "markdown", "source": [ "Some times we want to select certain dates from a dataset. Perhaps I wanted to gather the fourth of July week from the dataset, 01-07-18 to 07-07-18." ], "metadata": { "id": "x5v12Ith0ub4" } }, { "cell_type": "code", "source": [ "df.ArrivalDate.between('01-07-15','07-07-15')" ], "metadata": { "id": "QiN9g4001JDx", "outputId": "555be3be-ee2e-461d-d9c6-1f1b383425ff", "colab": { "base_uri": "https://localhost:8080/" } }, "execution_count": 32, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "0 True\n", "1 True\n", "2 True\n", "3 True\n", "4 True\n", " ... \n", "40055 False\n", "40056 False\n", "40057 False\n", "40058 False\n", "40059 False\n", "Name: ArrivalDate, Length: 40060, dtype: bool" ] }, "metadata": {}, "execution_count": 32 } ] }, { "cell_type": "markdown", "source": [ "Then to get at that data, we can pass the booleen values into the dataframe." ], "metadata": { "id": "aaJWieuu1ou5" } }, { "cell_type": "code", "source": [ "df[df.ArrivalDate.between('01-07-15','07-07-15')].tail(100)" ], "metadata": { "id": "h2xXBld_10Ro", "outputId": "d44ec74b-5e87-4c15-8f51-32f67bae54e9", "colab": { "base_uri": "https://localhost:8080/", "height": 488 } }, "execution_count": 35, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "\n", "
\n", "
\n", "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
IsCanceledLeadTimeArrivalDateYearArrivalDateMonthArrivalDateWeekNumberArrivalDateDayOfMonthStaysInWeekendNightsStaysInWeekNightsAdultsChildrenBabiesMealCountryMarketSegmentDistributionChannelIsRepeatedGuestPreviousCancellationsPreviousBookingsNotCanceledReservedRoomTypeAssignedRoomTypeBookingChangesDepositTypeAgentCompanyDaysInWaitingListCustomerTypeADRRequiredCarParkingSpacesTotalOfSpecialRequestsReservationStatusReservationStatusDateArrivalDate
2020662015July28704200BBPRTOnline TATA/TO000DD0No Deposit240NULL0Transient97.0002Check-Out2015-07-112015-07-07
2030882015July28704300HBUSAOffline TA/TOTA/TO000DE0No Deposit95NULL0Transient150.0001Check-Out2015-07-112015-07-07
204002015July28704200BBNLDDirectDirect000AA2No DepositNULLNULL0Transient98.0000Check-Out2015-07-112015-07-07
2051432015July28705200HBPRTOffline TA/TOTA/TO000AA0No Deposit134NULL0Transient91.5000Canceled2015-05-282015-07-07
2061882015July28725200HBPRTOnline TATA/TO000EE0No Deposit240NULL0Transient139.0002Canceled2015-04-132015-07-07
...................................................................................................
1544301852015July28638200BBNLDOffline TA/TOTA/TO000AA0No Deposit128NULL0Contract90.9500Check-Out2015-07-172015-07-06
1544701842015July28729200HBGBROffline TA/TOTA/TO000AA0No Deposit143NULL0Contract110.5000Check-Out2015-07-182015-07-07
1545901842015July274411200BBIRLOffline TA/TOTA/TO000AA0No Deposit156NULL0Contract90.9500Check-Out2015-07-192015-07-04
154600932015July285410200BBGBROffline TA/TOTA/TO000AA0No Deposit243NULL0Contract88.4001Check-Out2015-07-192015-07-05
1547001252015July285410200HBDEUOffline TA/TOTA/TO000AA1No Deposit69NULL0Contract113.0500Check-Out2015-07-192015-07-05
\n", "

100 rows × 32 columns

\n", "
\n", " \n", " \n", " \n", "\n", " \n", "
\n", "
\n", " " ], "text/plain": [ " IsCanceled LeadTime ... ReservationStatusDate ArrivalDate\n", "202 0 66 ... 2015-07-11 2015-07-07\n", "203 0 88 ... 2015-07-11 2015-07-07\n", "204 0 0 ... 2015-07-11 2015-07-07\n", "205 1 43 ... 2015-05-28 2015-07-07\n", "206 1 88 ... 2015-04-13 2015-07-07\n", "... ... ... ... ... ...\n", "15443 0 185 ... 2015-07-17 2015-07-06\n", "15447 0 184 ... 2015-07-18 2015-07-07\n", "15459 0 184 ... 2015-07-19 2015-07-04\n", "15460 0 93 ... 2015-07-19 2015-07-05\n", "15470 0 125 ... 2015-07-19 2015-07-05\n", "\n", "[100 rows x 32 columns]" ] }, "metadata": {}, "execution_count": 35 } ] }, { "cell_type": "markdown", "source": [ "The one strange thing about the `between` command is that it is inclusive so both the 1st and the 7th are included. If times are included only exactly at midnight on the 7th is included. You can change the inclusion with the command `inclusive` it can be `both`, `neither`, `left` or `right`." ], "metadata": { "id": "MtagPsu12Qpn" } }, { "cell_type": "markdown", "source": [ "## Your Turn" ], "metadata": { "id": "bI6DGE-CmGWX" } }, { "cell_type": "markdown", "source": [ "Using the dataset from an IOT device retreived from [here](https://www.kaggle.com/atulanandjha/temperature-readings-iot-devices) and introduced to [here](https://analyticsindiamag.com/10-datasets-for-data-cleaning-practice-for-beginners/). Uploaded to the web for you to retrieve easily here https://raw.githubusercontent.com/nurfnick/Data_Viz/main/IOT-temp.csv Answer the folloiwng questions.\n", "\n", "1. Convert the *noted_date* into DateTime, it is in day-month-Year Hour:Minute format.\n", "1. What is the minimum and maximum date and time?\n", "2. What is the largest interval inbetween temperature checks?\n", "3. What is the average datetime?\n", "4. What was the average outside temperature on '09-11-2018'?" ], "metadata": { "id": "P0ZHHjr2mI8m" } } ] }