Skip to content

Latest commit

 

History

History

dataset

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Load dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>P</th>\n",
       "      <th>T</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dates</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2000-01-01 00:00:00.000</th>\n",
       "      <td>4.461</td>\n",
       "      <td>76.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-01-01 00:04:38.500</th>\n",
       "      <td>4.469</td>\n",
       "      <td>77.062</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-01-01 00:07:32.500</th>\n",
       "      <td>4.484</td>\n",
       "      <td>77.375</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-01-01 00:08:25.000</th>\n",
       "      <td>4.477</td>\n",
       "      <td>77.375</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-01-01 00:40:12.500</th>\n",
       "      <td>4.461</td>\n",
       "      <td>77.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001-12-15 15:55:09.000</th>\n",
       "      <td>3.883</td>\n",
       "      <td>72.250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001-12-15 16:07:29.500</th>\n",
       "      <td>3.867</td>\n",
       "      <td>72.375</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001-12-15 16:14:00.000</th>\n",
       "      <td>3.875</td>\n",
       "      <td>72.875</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001-12-15 16:16:30.000</th>\n",
       "      <td>3.883</td>\n",
       "      <td>72.625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2001-12-15 16:18:48.000</th>\n",
       "      <td>3.914</td>\n",
       "      <td>72.250</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10399 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                             P       T\n",
       "dates                                 \n",
       "2000-01-01 00:00:00.000  4.461  76.000\n",
       "2000-01-01 00:04:38.500  4.469  77.062\n",
       "2000-01-01 00:07:32.500  4.484  77.375\n",
       "2000-01-01 00:08:25.000  4.477  77.375\n",
       "2000-01-01 00:40:12.500  4.461  77.000\n",
       "...                        ...     ...\n",
       "2001-12-15 15:55:09.000  3.883  72.250\n",
       "2001-12-15 16:07:29.500  3.867  72.375\n",
       "2001-12-15 16:14:00.000  3.875  72.875\n",
       "2001-12-15 16:16:30.000  3.883  72.625\n",
       "2001-12-15 16:18:48.000  3.914  72.250\n",
       "\n",
       "[10399 rows x 2 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv(\"dataset.csv\", index_col=\"dates\")\n",
    "data.index = pd.to_datetime(data.index, format=\"%Y-%m-%d %H:%M:%S.%f\")\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Load change points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>change_points_dates</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2000-03-08 08:49:37.500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2000-06-07 07:54:33.750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2000-09-03 09:30:45.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2000-12-02 05:32:15.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2001-03-02 06:11:12.750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2001-05-29 17:19:57.500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2001-08-29 19:25:40.750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2001-11-28 05:14:56.000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      change_points_dates\n",
       "0 2000-03-08 08:49:37.500\n",
       "1 2000-06-07 07:54:33.750\n",
       "2 2000-09-03 09:30:45.000\n",
       "3 2000-12-02 05:32:15.000\n",
       "4 2001-03-02 06:11:12.750\n",
       "5 2001-05-29 17:19:57.500\n",
       "6 2001-08-29 19:25:40.750\n",
       "7 2001-11-28 05:14:56.000"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cps = pd.read_csv(\"change_points.csv\")\n",
    "cps[\"change_points_dates\"] = pd.to_datetime(cps[\"change_points_dates\"], format=\"%Y-%m-%d %H:%M:%S.%f\")\n",
    "cps"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}