{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "tags": [ "remove-input" ] }, "outputs": [], "source": [ "# Reference: https://jupyterbook.org/interactive/hiding.html\n", "# Use {hide, remove}-{input, output, cell} tags to hiding content\n", "\n", "import sys\n", "import os\n", "if not any(path.endswith('textbook') for path in sys.path):\n", " sys.path.append(os.path.abspath('../../..'))\n", "from textbook_utils import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# The Constant Model\n", "\n", "A transit rider, Jake, often takes the northbound C bus at the 3rd \\& Pike\n", "bus stop in downtown Seattle.[^jake] The bus is supposed to arrive every 10\n", "minutes, but Jake notices that he sometimes waits a long time for the bus. He\n", "wants to know how late the bus usually is. \n", "Jake was able to acquire the scheduled arrival and actual arrival times for his bus\n", "from the Washington State Transportation Center. From these data, he can \n", "calculate the minutes that each bus is late to arrive at his stop:\n", "\n", "[^jake]: We (the authors) first learned of the bus arrival time data from an\n", " analysis by a data scientist named Jake VanderPlas. We've named the\n", " protagonist of this section in his honor. https://jakevdp.github.io/blog/2018/09/13/waiting-time-paradox/" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " | route | \n", "direction | \n", "scheduled | \n", "actual | \n", "minutes_late | \n", "
---|---|---|---|---|---|
0 | \n", "C | \n", "northbound | \n", "2016-03-26 06:30:28 | \n", "2016-03-26 06:26:04 | \n", "-4.40 | \n", "
1 | \n", "C | \n", "northbound | \n", "2016-03-26 01:05:25 | \n", "2016-03-26 01:10:15 | \n", "4.83 | \n", "
2 | \n", "C | \n", "northbound | \n", "2016-03-26 21:00:25 | \n", "2016-03-26 21:05:00 | \n", "4.58 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
1431 | \n", "C | \n", "northbound | \n", "2016-04-10 06:15:28 | \n", "2016-04-10 06:11:37 | \n", "-3.85 | \n", "
1432 | \n", "C | \n", "northbound | \n", "2016-04-10 17:00:28 | \n", "2016-04-10 16:56:54 | \n", "-3.57 | \n", "
1433 | \n", "C | \n", "northbound | \n", "2016-04-10 20:15:25 | \n", "2016-04-10 20:18:21 | \n", "2.93 | \n", "
1434 rows × 5 columns
\n", "