{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Prophet_Subject999.ipynb",
"provenance": [],
"collapsed_sections": [],
"toc_visible": true,
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "LoJMB6SV90h5",
"colab_type": "text"
},
"source": [
"# Oveview #\n",
"\n",
"Exploring Prophet using data recorded on a Google Spreadsheet for \"Subject 999\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5qbYO6kDMG9Z",
"colab_type": "text"
},
"source": [
"## A) Mount to personal folder ##"
]
},
{
"cell_type": "code",
"metadata": {
"id": "VC296HC34qEE",
"colab_type": "code",
"outputId": "8a58086a-14c5-4c82-9f2c-b4775d94d058",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 124
}
},
"source": [
"from google.colab import drive\n",
"drive.mount('/content/gdrive', force_remount=False)\n",
"\n",
"from pydrive.auth import GoogleAuth\n",
"from pydrive.drive import GoogleDrive\n",
"from google.colab import auth\n",
"from oauth2client.client import GoogleCredentials"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n",
"\n",
"Enter your authorization code:\n",
"··········\n",
"Mounted at /content/gdrive\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "uWES420yhc7j",
"colab_type": "text"
},
"source": [
"## B) Retrieve data entered on a Google spreadsheet ##"
]
},
{
"cell_type": "code",
"metadata": {
"id": "9QMACjCsQJyu",
"colab_type": "code",
"colab": {}
},
"source": [
"from google.colab import auth\n",
"\n",
"auth.authenticate_user()\n",
"\n",
"import gspread\n",
"\n",
"from oauth2client.client import GoogleCredentials\n",
"gc= gspread.authorize(GoogleCredentials.get_application_default())\n",
"\n",
"# public\n",
"url='https://docs.google.com/spreadsheets/d/1XFAyPqcigAaLK8W6I1P0IFAOoWXfSFnfGXTFUM-uGVw/'\n",
"\n",
"wb= gc.open_by_url(url)\n",
"\n",
"sheet = wb.worksheet('data')\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "kKN0bWLTSjEA",
"colab_type": "code",
"outputId": "4688bb1a-824c-488b-a458-b575d45b6c86",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 206
}
},
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"\n",
"data = sheet.get_all_values()\n",
"\n",
"df = pd.DataFrame( data )\n",
"df.head()"
],
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"
\n", " | 0 | \n", "1 | \n", "2 | \n", "3 | \n", "4 | \n", "5 | \n", "6 | \n", "7 | \n", "8 | \n", "9 | \n", "10 | \n", "11 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "Day | \n", "# | \n", "\n", " | Yeear | \n", "Month | \n", "Date | \n", "Time | \n", "SBP | \n", "DBP\\n | \n", "Heart Rate | \n", "Side | \n", "\n", " |
1 | \n", "0 | \n", "0 | \n", "\n", " | 2019 | \n", "12 | \n", "15 | \n", "AM | \n", "153 | \n", "84 | \n", "66 | \n", "\n", " | =sum($B$26:B27) ' | \n", "
2 | \n", "1 | \n", "1 | \n", "\n", " | 2019 | \n", "12 | \n", "15 | \n", "AM | \n", "142 | \n", "74 | \n", "70 | \n", "\n", " | \n", " |
3 | \n", "1 | \n", "0 | \n", "\n", " | 2019 | \n", "12 | \n", "16 | \n", "AM | \n", "147 | \n", "80 | \n", "71 | \n", "\n", " | \n", " |
4 | \n", "1 | \n", "0 | \n", "\n", " | 2019 | \n", "12 | \n", "16 | \n", "AM | \n", "138 | \n", "70 | \n", "65 | \n", "\n", " | \n", " |
\n", " | ds | \n", "y | \n", "hr | \n", "
---|---|---|---|
0 | \n", "2019-12-15 | \n", "153 | \n", "66 | \n", "
1 | \n", "2019-12-16 | \n", "147 | \n", "71 | \n", "
2 | \n", "2019-12-19 | \n", "122 | \n", "75 | \n", "
3 | \n", "2019-12-22 | \n", "164 | \n", "74 | \n", "
4 | \n", "2019-12-24 | \n", "119 | \n", "70 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "
76 | \n", "2020-03-21 | \n", "136 | \n", "91 | \n", "
77 | \n", "2020-03-22 | \n", "99 | \n", "76 | \n", "
78 | \n", "2020-03-23 | \n", "110 | \n", "83 | \n", "
79 | \n", "2020-03-24 | \n", "118 | \n", "66 | \n", "
80 | \n", "2020-03-25 | \n", "108 | \n", "72 | \n", "
81 rows × 3 columns
\n", "