mirror of
https://github.com/sstent/go-garth.git
synced 2026-01-25 16:42:28 +00:00
1084 lines
1.2 MiB
1084 lines
1.2 MiB
{
|
||
"nbformat": 4,
|
||
"nbformat_minor": 0,
|
||
"metadata": {
|
||
"colab": {
|
||
"provenance": [],
|
||
"authorship_tag": "ABX9TyNzwzBxhj/ENtPvpC3sc3iq",
|
||
"include_colab_link": true
|
||
},
|
||
"kernelspec": {
|
||
"name": "python3",
|
||
"display_name": "Python 3"
|
||
},
|
||
"language_info": {
|
||
"name": "python"
|
||
},
|
||
"widgets": {
|
||
"application/vnd.jupyter.widget-state+json": {
|
||
"b7d1a1e77d344a8e9b65fa0887859b6f": {
|
||
"model_module": "@jupyter-widgets/controls",
|
||
"model_name": "ButtonModel",
|
||
"model_module_version": "1.5.0",
|
||
"state": {
|
||
"_dom_classes": [],
|
||
"_model_module": "@jupyter-widgets/controls",
|
||
"_model_module_version": "1.5.0",
|
||
"_model_name": "ButtonModel",
|
||
"_view_count": null,
|
||
"_view_module": "@jupyter-widgets/controls",
|
||
"_view_module_version": "1.5.0",
|
||
"_view_name": "ButtonView",
|
||
"button_style": "",
|
||
"description": "Download CSV",
|
||
"disabled": false,
|
||
"icon": "",
|
||
"layout": "IPY_MODEL_f4c0da5a7d7641bdab1fdf2d2a5a434c",
|
||
"style": "IPY_MODEL_c57ce657dd1b49bea27a6d5f9f232205",
|
||
"tooltip": ""
|
||
}
|
||
},
|
||
"f4c0da5a7d7641bdab1fdf2d2a5a434c": {
|
||
"model_module": "@jupyter-widgets/base",
|
||
"model_name": "LayoutModel",
|
||
"model_module_version": "1.2.0",
|
||
"state": {
|
||
"_model_module": "@jupyter-widgets/base",
|
||
"_model_module_version": "1.2.0",
|
||
"_model_name": "LayoutModel",
|
||
"_view_count": null,
|
||
"_view_module": "@jupyter-widgets/base",
|
||
"_view_module_version": "1.2.0",
|
||
"_view_name": "LayoutView",
|
||
"align_content": null,
|
||
"align_items": null,
|
||
"align_self": null,
|
||
"border": null,
|
||
"bottom": null,
|
||
"display": null,
|
||
"flex": null,
|
||
"flex_flow": null,
|
||
"grid_area": null,
|
||
"grid_auto_columns": null,
|
||
"grid_auto_flow": null,
|
||
"grid_auto_rows": null,
|
||
"grid_column": null,
|
||
"grid_gap": null,
|
||
"grid_row": null,
|
||
"grid_template_areas": null,
|
||
"grid_template_columns": null,
|
||
"grid_template_rows": null,
|
||
"height": null,
|
||
"justify_content": null,
|
||
"justify_items": null,
|
||
"left": null,
|
||
"margin": null,
|
||
"max_height": null,
|
||
"max_width": null,
|
||
"min_height": null,
|
||
"min_width": null,
|
||
"object_fit": null,
|
||
"object_position": null,
|
||
"order": null,
|
||
"overflow": null,
|
||
"overflow_x": null,
|
||
"overflow_y": null,
|
||
"padding": null,
|
||
"right": null,
|
||
"top": null,
|
||
"visibility": null,
|
||
"width": null
|
||
}
|
||
},
|
||
"c57ce657dd1b49bea27a6d5f9f232205": {
|
||
"model_module": "@jupyter-widgets/controls",
|
||
"model_name": "ButtonStyleModel",
|
||
"model_module_version": "1.5.0",
|
||
"state": {
|
||
"_model_module": "@jupyter-widgets/controls",
|
||
"_model_module_version": "1.5.0",
|
||
"_model_name": "ButtonStyleModel",
|
||
"_view_count": null,
|
||
"_view_module": "@jupyter-widgets/base",
|
||
"_view_module_version": "1.2.0",
|
||
"_view_name": "StyleView",
|
||
"button_color": null,
|
||
"font_weight": ""
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"cells": [
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {
|
||
"id": "view-in-github",
|
||
"colab_type": "text"
|
||
},
|
||
"source": [
|
||
"<a href=\"https://colab.research.google.com/github/matin/garth/blob/main/colabs/chatgpt_analysis_of_stats.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"# chatGPT analysis of Garmin stats"
|
||
],
|
||
"metadata": {
|
||
"id": "gsR7Ay0KuqGl"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"## Setup"
|
||
],
|
||
"metadata": {
|
||
"id": "AuY_RBBruxkA"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"Install [Garth](https://github.com/matin/garth) to download stats from Garmin Connect."
|
||
],
|
||
"metadata": {
|
||
"id": "yg5Hzyrbu2SV"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"metadata": {
|
||
"id": "2YBVvyYJnRug"
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"%pip install garth >& /dev/null"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"Set location of session tokens."
|
||
],
|
||
"metadata": {
|
||
"id": "ZTzxkfQQu-fJ"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"GARTH_HOME = \"drive/MyDrive/garth\""
|
||
],
|
||
"metadata": {
|
||
"id": "FPkG6WzOnfdP"
|
||
},
|
||
"execution_count": 2,
|
||
"outputs": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"Mount Google Drive to access session tokens."
|
||
],
|
||
"metadata": {
|
||
"id": "QeSi-VipvBa3"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"from google.colab import drive\n",
|
||
"drive.mount(\"/content/drive\")"
|
||
],
|
||
"metadata": {
|
||
"colab": {
|
||
"base_uri": "https://localhost:8080/"
|
||
},
|
||
"id": "5nWiUmA5nh8k",
|
||
"outputId": "f8acf58a-3275-4b6f-b2b5-05c85a4585af"
|
||
},
|
||
"execution_count": 3,
|
||
"outputs": [
|
||
{
|
||
"output_type": "stream",
|
||
"name": "stdout",
|
||
"text": [
|
||
"Mounted at /content/drive\n"
|
||
]
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"Attempt to resume session. Otherwise, log in. Save updated session in both cases."
|
||
],
|
||
"metadata": {
|
||
"id": "youB5vWsvGwv"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"import garth\n",
|
||
"from garth.exc import GarthException\n",
|
||
"from getpass import getpass\n",
|
||
"\n",
|
||
"try:\n",
|
||
" garth.resume(GARTH_HOME)\n",
|
||
" garth.client.username\n",
|
||
"except (FileNotFoundError, GarthException):\n",
|
||
" email = input(\"Email: \")\n",
|
||
" password = getpass(\"Password: \")\n",
|
||
" garth.client.login(email, password)\n",
|
||
"\n",
|
||
"garth.save(GARTH_HOME)"
|
||
],
|
||
"metadata": {
|
||
"id": "jFYjpHMwnmRF"
|
||
},
|
||
"execution_count": 4,
|
||
"outputs": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"Import Pandas and define period for analysis."
|
||
],
|
||
"metadata": {
|
||
"id": "s09TVMCTvSEy"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"import pandas as pd\n",
|
||
"\n",
|
||
"DAYS = 365 * 3"
|
||
],
|
||
"metadata": {
|
||
"id": "r18SHYm6n_i9"
|
||
},
|
||
"execution_count": 5,
|
||
"outputs": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"## Query stats"
|
||
],
|
||
"metadata": {
|
||
"id": "fHsEkJQNo_o0"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"### Sleep"
|
||
],
|
||
"metadata": {
|
||
"id": "JFdWsRJHnw1H"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"from datetime import timedelta\n",
|
||
"\n",
|
||
"sleep = pd.DataFrame(garth.DailySleep.list(period=DAYS))\n",
|
||
"sleep[\"calendar_date\"] = sleep[\"calendar_date\"].apply(lambda x: x - timedelta(days=1))\n",
|
||
"sleep.set_index(\"calendar_date\", inplace=True)\n",
|
||
"sleep.rename(columns={\"value\": \"sleep_quality\"}, inplace=True)"
|
||
],
|
||
"metadata": {
|
||
"id": "cKH4pkwtoHt9"
|
||
},
|
||
"execution_count": 6,
|
||
"outputs": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"### Steps"
|
||
],
|
||
"metadata": {
|
||
"id": "KXe5NV8HoYxZ"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"steps = pd.DataFrame(garth.DailySteps.list(period=DAYS))\n",
|
||
"steps.set_index(\"calendar_date\", inplace=True)"
|
||
],
|
||
"metadata": {
|
||
"id": "uaG8YTPjobC8"
|
||
},
|
||
"execution_count": 7,
|
||
"outputs": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"### Stress"
|
||
],
|
||
"metadata": {
|
||
"id": "YbV8jW-QofcS"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"stress = pd.DataFrame(garth.DailyStress.list(period=DAYS))\n",
|
||
"stress.set_index(\"calendar_date\", inplace=True)\n",
|
||
"stress[\"high_stress_duration\"].fillna(0, inplace=True)\n",
|
||
"stress[\"medium_stress_duration\"].fillna(0, inplace=True)"
|
||
],
|
||
"metadata": {
|
||
"id": "lThQ23Rjog-Z"
|
||
},
|
||
"execution_count": 8,
|
||
"outputs": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"### Intensity minutes"
|
||
],
|
||
"metadata": {
|
||
"id": "-NjiZ8OKoj3-"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"im = pd.DataFrame(garth.DailyIntensityMinutes.list(period=DAYS))\n",
|
||
"im.set_index(\"calendar_date\", inplace=True)\n",
|
||
"im[\"intensity_minutes\"] = im[\"moderate_value\"] + 2 * im[\"vigorous_value\"]\n",
|
||
"im.rename(\n",
|
||
" columns={\n",
|
||
" \"weekly_goal\": \"intensity_minutes_goal\",\n",
|
||
" \"moderate_value\": \"moderate_intensity_minutes\",\n",
|
||
" \"vigorous_value\": \"vigorous_intensity_minutes\",\n",
|
||
" },\n",
|
||
" inplace=True\n",
|
||
")"
|
||
],
|
||
"metadata": {
|
||
"id": "9BcHMdXzol6U"
|
||
},
|
||
"execution_count": 9,
|
||
"outputs": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"## Join stats"
|
||
],
|
||
"metadata": {
|
||
"id": "NEaoXU7JpCve"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"stats = (\n",
|
||
" sleep\n",
|
||
" .join(steps)\n",
|
||
" .join(stress)\n",
|
||
" .join(im)\n",
|
||
")\n",
|
||
"stats"
|
||
],
|
||
"metadata": {
|
||
"colab": {
|
||
"base_uri": "https://localhost:8080/",
|
||
"height": 475
|
||
},
|
||
"id": "hcLk5XzdpFZP",
|
||
"outputId": "9c7b40e3-7c58-4978-bcbe-38d20513199f"
|
||
},
|
||
"execution_count": 10,
|
||
"outputs": [
|
||
{
|
||
"output_type": "execute_result",
|
||
"data": {
|
||
"text/plain": [
|
||
" sleep_quality total_steps total_distance step_goal \\\n",
|
||
"calendar_date \n",
|
||
"2021-09-08 64 2728 2259 8830 \n",
|
||
"2021-09-09 65 7601 6338 7610 \n",
|
||
"2021-09-10 81 25646 19797 7610 \n",
|
||
"2021-09-11 0 6869 5701 9420 \n",
|
||
"2021-09-13 76 17210 15660 8970 \n",
|
||
"... ... ... ... ... \n",
|
||
"2023-09-27 85 6367 5349 8740 \n",
|
||
"2023-09-28 80 2363 2072 8510 \n",
|
||
"2023-09-29 86 11261 8675 7280 \n",
|
||
"2023-09-30 79 8130 6742 7680 \n",
|
||
"2023-10-01 46 25434 21006 7770 \n",
|
||
"\n",
|
||
" overall_stress_level rest_stress_duration \\\n",
|
||
"calendar_date \n",
|
||
"2021-09-08 26 50100 \n",
|
||
"2021-09-09 32 29100 \n",
|
||
"2021-09-10 31 30780 \n",
|
||
"2021-09-11 28 37380 \n",
|
||
"2021-09-13 37 25440 \n",
|
||
"... ... ... \n",
|
||
"2023-09-27 30 34980 \n",
|
||
"2023-09-28 29 40740 \n",
|
||
"2023-09-29 38 32880 \n",
|
||
"2023-09-30 29 42120 \n",
|
||
"2023-10-01 30 36900 \n",
|
||
"\n",
|
||
" low_stress_duration medium_stress_duration \\\n",
|
||
"calendar_date \n",
|
||
"2021-09-08 14400 10020 \n",
|
||
"2021-09-09 24420 8520 \n",
|
||
"2021-09-10 16500 5880 \n",
|
||
"2021-09-11 18720 7380 \n",
|
||
"2021-09-13 16440 13680 \n",
|
||
"... ... ... \n",
|
||
"2023-09-27 20460 6600 \n",
|
||
"2023-09-28 23580 8520 \n",
|
||
"2023-09-29 11520 11400 \n",
|
||
"2023-09-30 15660 9840 \n",
|
||
"2023-10-01 8640 7680 \n",
|
||
"\n",
|
||
" high_stress_duration intensity_minutes_goal \\\n",
|
||
"calendar_date \n",
|
||
"2021-09-08 1500.0 150 \n",
|
||
"2021-09-09 1680.0 150 \n",
|
||
"2021-09-10 4020.0 150 \n",
|
||
"2021-09-11 1020.0 150 \n",
|
||
"2021-09-13 4200.0 150 \n",
|
||
"... ... ... \n",
|
||
"2023-09-27 1200.0 150 \n",
|
||
"2023-09-28 1200.0 150 \n",
|
||
"2023-09-29 8160.0 150 \n",
|
||
"2023-09-30 900.0 150 \n",
|
||
"2023-10-01 4140.0 150 \n",
|
||
"\n",
|
||
" moderate_intensity_minutes vigorous_intensity_minutes \\\n",
|
||
"calendar_date \n",
|
||
"2021-09-08 0.0 0.0 \n",
|
||
"2021-09-09 0.0 0.0 \n",
|
||
"2021-09-10 117.0 46.0 \n",
|
||
"2021-09-11 0.0 0.0 \n",
|
||
"2021-09-13 7.0 41.0 \n",
|
||
"... ... ... \n",
|
||
"2023-09-27 0.0 0.0 \n",
|
||
"2023-09-28 0.0 0.0 \n",
|
||
"2023-09-29 44.0 2.0 \n",
|
||
"2023-09-30 0.0 0.0 \n",
|
||
"2023-10-01 77.0 56.0 \n",
|
||
"\n",
|
||
" intensity_minutes \n",
|
||
"calendar_date \n",
|
||
"2021-09-08 0.0 \n",
|
||
"2021-09-09 0.0 \n",
|
||
"2021-09-10 209.0 \n",
|
||
"2021-09-11 0.0 \n",
|
||
"2021-09-13 89.0 \n",
|
||
"... ... \n",
|
||
"2023-09-27 0.0 \n",
|
||
"2023-09-28 0.0 \n",
|
||
"2023-09-29 48.0 \n",
|
||
"2023-09-30 0.0 \n",
|
||
"2023-10-01 189.0 \n",
|
||
"\n",
|
||
"[743 rows x 13 columns]"
|
||
],
|
||
"text/html": [
|
||
"\n",
|
||
" <div id=\"df-eda11518-8a49-4a89-9d7d-52c1b9fdc69e\" class=\"colab-df-container\">\n",
|
||
" <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>sleep_quality</th>\n",
|
||
" <th>total_steps</th>\n",
|
||
" <th>total_distance</th>\n",
|
||
" <th>step_goal</th>\n",
|
||
" <th>overall_stress_level</th>\n",
|
||
" <th>rest_stress_duration</th>\n",
|
||
" <th>low_stress_duration</th>\n",
|
||
" <th>medium_stress_duration</th>\n",
|
||
" <th>high_stress_duration</th>\n",
|
||
" <th>intensity_minutes_goal</th>\n",
|
||
" <th>moderate_intensity_minutes</th>\n",
|
||
" <th>vigorous_intensity_minutes</th>\n",
|
||
" <th>intensity_minutes</th>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>calendar_date</th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" <th></th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>2021-09-08</th>\n",
|
||
" <td>64</td>\n",
|
||
" <td>2728</td>\n",
|
||
" <td>2259</td>\n",
|
||
" <td>8830</td>\n",
|
||
" <td>26</td>\n",
|
||
" <td>50100</td>\n",
|
||
" <td>14400</td>\n",
|
||
" <td>10020</td>\n",
|
||
" <td>1500.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2021-09-09</th>\n",
|
||
" <td>65</td>\n",
|
||
" <td>7601</td>\n",
|
||
" <td>6338</td>\n",
|
||
" <td>7610</td>\n",
|
||
" <td>32</td>\n",
|
||
" <td>29100</td>\n",
|
||
" <td>24420</td>\n",
|
||
" <td>8520</td>\n",
|
||
" <td>1680.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2021-09-10</th>\n",
|
||
" <td>81</td>\n",
|
||
" <td>25646</td>\n",
|
||
" <td>19797</td>\n",
|
||
" <td>7610</td>\n",
|
||
" <td>31</td>\n",
|
||
" <td>30780</td>\n",
|
||
" <td>16500</td>\n",
|
||
" <td>5880</td>\n",
|
||
" <td>4020.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>117.0</td>\n",
|
||
" <td>46.0</td>\n",
|
||
" <td>209.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2021-09-11</th>\n",
|
||
" <td>0</td>\n",
|
||
" <td>6869</td>\n",
|
||
" <td>5701</td>\n",
|
||
" <td>9420</td>\n",
|
||
" <td>28</td>\n",
|
||
" <td>37380</td>\n",
|
||
" <td>18720</td>\n",
|
||
" <td>7380</td>\n",
|
||
" <td>1020.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2021-09-13</th>\n",
|
||
" <td>76</td>\n",
|
||
" <td>17210</td>\n",
|
||
" <td>15660</td>\n",
|
||
" <td>8970</td>\n",
|
||
" <td>37</td>\n",
|
||
" <td>25440</td>\n",
|
||
" <td>16440</td>\n",
|
||
" <td>13680</td>\n",
|
||
" <td>4200.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>7.0</td>\n",
|
||
" <td>41.0</td>\n",
|
||
" <td>89.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>...</th>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>...</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2023-09-27</th>\n",
|
||
" <td>85</td>\n",
|
||
" <td>6367</td>\n",
|
||
" <td>5349</td>\n",
|
||
" <td>8740</td>\n",
|
||
" <td>30</td>\n",
|
||
" <td>34980</td>\n",
|
||
" <td>20460</td>\n",
|
||
" <td>6600</td>\n",
|
||
" <td>1200.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2023-09-28</th>\n",
|
||
" <td>80</td>\n",
|
||
" <td>2363</td>\n",
|
||
" <td>2072</td>\n",
|
||
" <td>8510</td>\n",
|
||
" <td>29</td>\n",
|
||
" <td>40740</td>\n",
|
||
" <td>23580</td>\n",
|
||
" <td>8520</td>\n",
|
||
" <td>1200.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2023-09-29</th>\n",
|
||
" <td>86</td>\n",
|
||
" <td>11261</td>\n",
|
||
" <td>8675</td>\n",
|
||
" <td>7280</td>\n",
|
||
" <td>38</td>\n",
|
||
" <td>32880</td>\n",
|
||
" <td>11520</td>\n",
|
||
" <td>11400</td>\n",
|
||
" <td>8160.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>44.0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>48.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2023-09-30</th>\n",
|
||
" <td>79</td>\n",
|
||
" <td>8130</td>\n",
|
||
" <td>6742</td>\n",
|
||
" <td>7680</td>\n",
|
||
" <td>29</td>\n",
|
||
" <td>42120</td>\n",
|
||
" <td>15660</td>\n",
|
||
" <td>9840</td>\n",
|
||
" <td>900.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2023-10-01</th>\n",
|
||
" <td>46</td>\n",
|
||
" <td>25434</td>\n",
|
||
" <td>21006</td>\n",
|
||
" <td>7770</td>\n",
|
||
" <td>30</td>\n",
|
||
" <td>36900</td>\n",
|
||
" <td>8640</td>\n",
|
||
" <td>7680</td>\n",
|
||
" <td>4140.0</td>\n",
|
||
" <td>150</td>\n",
|
||
" <td>77.0</td>\n",
|
||
" <td>56.0</td>\n",
|
||
" <td>189.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"<p>743 rows × 13 columns</p>\n",
|
||
"</div>\n",
|
||
" <div class=\"colab-df-buttons\">\n",
|
||
"\n",
|
||
" <div class=\"colab-df-container\">\n",
|
||
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-eda11518-8a49-4a89-9d7d-52c1b9fdc69e')\"\n",
|
||
" title=\"Convert this dataframe to an interactive table.\"\n",
|
||
" style=\"display:none;\">\n",
|
||
"\n",
|
||
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
|
||
" <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
|
||
" </svg>\n",
|
||
" </button>\n",
|
||
"\n",
|
||
" <style>\n",
|
||
" .colab-df-container {\n",
|
||
" display:flex;\n",
|
||
" gap: 12px;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .colab-df-convert {\n",
|
||
" background-color: #E8F0FE;\n",
|
||
" border: none;\n",
|
||
" border-radius: 50%;\n",
|
||
" cursor: pointer;\n",
|
||
" display: none;\n",
|
||
" fill: #1967D2;\n",
|
||
" height: 32px;\n",
|
||
" padding: 0 0 0 0;\n",
|
||
" width: 32px;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .colab-df-convert:hover {\n",
|
||
" background-color: #E2EBFA;\n",
|
||
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
||
" fill: #174EA6;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .colab-df-buttons div {\n",
|
||
" margin-bottom: 4px;\n",
|
||
" }\n",
|
||
"\n",
|
||
" [theme=dark] .colab-df-convert {\n",
|
||
" background-color: #3B4455;\n",
|
||
" fill: #D2E3FC;\n",
|
||
" }\n",
|
||
"\n",
|
||
" [theme=dark] .colab-df-convert:hover {\n",
|
||
" background-color: #434B5C;\n",
|
||
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
||
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
||
" fill: #FFFFFF;\n",
|
||
" }\n",
|
||
" </style>\n",
|
||
"\n",
|
||
" <script>\n",
|
||
" const buttonEl =\n",
|
||
" document.querySelector('#df-eda11518-8a49-4a89-9d7d-52c1b9fdc69e button.colab-df-convert');\n",
|
||
" buttonEl.style.display =\n",
|
||
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
||
"\n",
|
||
" async function convertToInteractive(key) {\n",
|
||
" const element = document.querySelector('#df-eda11518-8a49-4a89-9d7d-52c1b9fdc69e');\n",
|
||
" const dataTable =\n",
|
||
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
||
" [key], {});\n",
|
||
" if (!dataTable) return;\n",
|
||
"\n",
|
||
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
||
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
||
" + ' to learn more about interactive tables.';\n",
|
||
" element.innerHTML = '';\n",
|
||
" dataTable['output_type'] = 'display_data';\n",
|
||
" await google.colab.output.renderOutput(dataTable, element);\n",
|
||
" const docLink = document.createElement('div');\n",
|
||
" docLink.innerHTML = docLinkHtml;\n",
|
||
" element.appendChild(docLink);\n",
|
||
" }\n",
|
||
" </script>\n",
|
||
" </div>\n",
|
||
"\n",
|
||
"\n",
|
||
"<div id=\"df-d984331d-7628-428c-b7fb-1d12c00f81e9\">\n",
|
||
" <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-d984331d-7628-428c-b7fb-1d12c00f81e9')\"\n",
|
||
" title=\"Suggest charts.\"\n",
|
||
" style=\"display:none;\">\n",
|
||
"\n",
|
||
"<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
||
" width=\"24px\">\n",
|
||
" <g>\n",
|
||
" <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
|
||
" </g>\n",
|
||
"</svg>\n",
|
||
" </button>\n",
|
||
"\n",
|
||
"<style>\n",
|
||
" .colab-df-quickchart {\n",
|
||
" --bg-color: #E8F0FE;\n",
|
||
" --fill-color: #1967D2;\n",
|
||
" --hover-bg-color: #E2EBFA;\n",
|
||
" --hover-fill-color: #174EA6;\n",
|
||
" --disabled-fill-color: #AAA;\n",
|
||
" --disabled-bg-color: #DDD;\n",
|
||
" }\n",
|
||
"\n",
|
||
" [theme=dark] .colab-df-quickchart {\n",
|
||
" --bg-color: #3B4455;\n",
|
||
" --fill-color: #D2E3FC;\n",
|
||
" --hover-bg-color: #434B5C;\n",
|
||
" --hover-fill-color: #FFFFFF;\n",
|
||
" --disabled-bg-color: #3B4455;\n",
|
||
" --disabled-fill-color: #666;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .colab-df-quickchart {\n",
|
||
" background-color: var(--bg-color);\n",
|
||
" border: none;\n",
|
||
" border-radius: 50%;\n",
|
||
" cursor: pointer;\n",
|
||
" display: none;\n",
|
||
" fill: var(--fill-color);\n",
|
||
" height: 32px;\n",
|
||
" padding: 0;\n",
|
||
" width: 32px;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .colab-df-quickchart:hover {\n",
|
||
" background-color: var(--hover-bg-color);\n",
|
||
" box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
||
" fill: var(--button-hover-fill-color);\n",
|
||
" }\n",
|
||
"\n",
|
||
" .colab-df-quickchart-complete:disabled,\n",
|
||
" .colab-df-quickchart-complete:disabled:hover {\n",
|
||
" background-color: var(--disabled-bg-color);\n",
|
||
" fill: var(--disabled-fill-color);\n",
|
||
" box-shadow: none;\n",
|
||
" }\n",
|
||
"\n",
|
||
" .colab-df-spinner {\n",
|
||
" border: 2px solid var(--fill-color);\n",
|
||
" border-color: transparent;\n",
|
||
" border-bottom-color: var(--fill-color);\n",
|
||
" animation:\n",
|
||
" spin 1s steps(1) infinite;\n",
|
||
" }\n",
|
||
"\n",
|
||
" @keyframes spin {\n",
|
||
" 0% {\n",
|
||
" border-color: transparent;\n",
|
||
" border-bottom-color: var(--fill-color);\n",
|
||
" border-left-color: var(--fill-color);\n",
|
||
" }\n",
|
||
" 20% {\n",
|
||
" border-color: transparent;\n",
|
||
" border-left-color: var(--fill-color);\n",
|
||
" border-top-color: var(--fill-color);\n",
|
||
" }\n",
|
||
" 30% {\n",
|
||
" border-color: transparent;\n",
|
||
" border-left-color: var(--fill-color);\n",
|
||
" border-top-color: var(--fill-color);\n",
|
||
" border-right-color: var(--fill-color);\n",
|
||
" }\n",
|
||
" 40% {\n",
|
||
" border-color: transparent;\n",
|
||
" border-right-color: var(--fill-color);\n",
|
||
" border-top-color: var(--fill-color);\n",
|
||
" }\n",
|
||
" 60% {\n",
|
||
" border-color: transparent;\n",
|
||
" border-right-color: var(--fill-color);\n",
|
||
" }\n",
|
||
" 80% {\n",
|
||
" border-color: transparent;\n",
|
||
" border-right-color: var(--fill-color);\n",
|
||
" border-bottom-color: var(--fill-color);\n",
|
||
" }\n",
|
||
" 90% {\n",
|
||
" border-color: transparent;\n",
|
||
" border-bottom-color: var(--fill-color);\n",
|
||
" }\n",
|
||
" }\n",
|
||
"</style>\n",
|
||
"\n",
|
||
" <script>\n",
|
||
" async function quickchart(key) {\n",
|
||
" const quickchartButtonEl =\n",
|
||
" document.querySelector('#' + key + ' button');\n",
|
||
" quickchartButtonEl.disabled = true; // To prevent multiple clicks.\n",
|
||
" quickchartButtonEl.classList.add('colab-df-spinner');\n",
|
||
" try {\n",
|
||
" const charts = await google.colab.kernel.invokeFunction(\n",
|
||
" 'suggestCharts', [key], {});\n",
|
||
" } catch (error) {\n",
|
||
" console.error('Error during call to suggestCharts:', error);\n",
|
||
" }\n",
|
||
" quickchartButtonEl.classList.remove('colab-df-spinner');\n",
|
||
" quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
|
||
" }\n",
|
||
" (() => {\n",
|
||
" let quickchartButtonEl =\n",
|
||
" document.querySelector('#df-d984331d-7628-428c-b7fb-1d12c00f81e9 button');\n",
|
||
" quickchartButtonEl.style.display =\n",
|
||
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
||
" })();\n",
|
||
" </script>\n",
|
||
"</div>\n",
|
||
" </div>\n",
|
||
" </div>\n"
|
||
]
|
||
},
|
||
"metadata": {},
|
||
"execution_count": 10
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"## Download as a CSV that can be uploaded to chatGPT."
|
||
],
|
||
"metadata": {
|
||
"id": "DYpdJ-vwve6g"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"source": [
|
||
"from google.colab import files\n",
|
||
"from ipywidgets import widgets\n",
|
||
"from IPython.display import display\n",
|
||
"\n",
|
||
"def create_download_button(df, filename):\n",
|
||
" def export_csv(df):\n",
|
||
" df.to_csv(filename)\n",
|
||
" files.download(filename)\n",
|
||
"\n",
|
||
" button = widgets.Button(description=\"Download CSV\")\n",
|
||
" button.on_click(lambda b: export_csv(df))\n",
|
||
" display(button)\n",
|
||
"\n",
|
||
"create_download_button(stats, \"consolidated_garmin_stats.csv\")"
|
||
],
|
||
"metadata": {
|
||
"colab": {
|
||
"base_uri": "https://localhost:8080/",
|
||
"height": 49,
|
||
"referenced_widgets": [
|
||
"b7d1a1e77d344a8e9b65fa0887859b6f",
|
||
"f4c0da5a7d7641bdab1fdf2d2a5a434c",
|
||
"c57ce657dd1b49bea27a6d5f9f232205"
|
||
]
|
||
},
|
||
"id": "nEbaWK7Dpqzj",
|
||
"outputId": "0781f65e-0e21-4bd7-ac88-00c3f4891cc5"
|
||
},
|
||
"execution_count": 11,
|
||
"outputs": [
|
||
{
|
||
"output_type": "display_data",
|
||
"data": {
|
||
"text/plain": [
|
||
"Button(description='Download CSV', style=ButtonStyle())"
|
||
],
|
||
"application/vnd.jupyter.widget-view+json": {
|
||
"version_major": 2,
|
||
"version_minor": 0,
|
||
"model_id": "b7d1a1e77d344a8e9b65fa0887859b6f"
|
||
}
|
||
},
|
||
"metadata": {}
|
||
}
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"## chatGPT data analysis"
|
||
],
|
||
"metadata": {
|
||
"id": "G4lI4sPqt9Gj"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"Upload the CSV to chatGPT and ask the following questions:"
|
||
],
|
||
"metadata": {
|
||
"id": "Aw_VA0VHwwHD"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"---"
|
||
],
|
||
"metadata": {
|
||
"id": "zydPs3afw21Q"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"How do I sleep on different days of the week?"
|
||
],
|
||
"metadata": {
|
||
"id": "zirj_VC8uAsB"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
""
|
||
],
|
||
"metadata": {
|
||
"id": "TqFfxR2ExizU"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"How does my sleep relate to the other stats? Is it correlated with any of the other stats?"
|
||
],
|
||
"metadata": {
|
||
"id": "vscLdhVruWiw"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
""
|
||
],
|
||
"metadata": {
|
||
"id": "cbWEhT4axXx4"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
"On what days do I exercise the most?"
|
||
],
|
||
"metadata": {
|
||
"id": "LyUsbbn6udDb"
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"source": [
|
||
""
|
||
],
|
||
"metadata": {
|
||
"id": "DjKiCw35xx17"
|
||
}
|
||
}
|
||
]
|
||
} |