{ "cells": [ { "cell_type": "markdown", "source": [ "**What does this notebook do?**\n", "- Load the exported CGM values from NutriSense\n", "- Print out what days are included in the dataset\n", "- Filter down CGM data to only one day\n", "- Plot CGM data for that day" ], "metadata": {} }, { "cell_type": "code", "execution_count": null, "source": [ "import pandas as pd\n", "import plotly.express as px\n", "import datetime\n", "\n", "# Read in CSV file\n", "df = pd.read_csv('export.csv')\n", "\n", "# Remove \"time zone offset\" from \"occurred_at\" column and add new \"occurred_at_day\" column\n", "df['occurred_at_day'] = df['occurred_at'].apply(lambda x: x[:len(x) - 15])\n", "df['occurred_at'] = df['occurred_at'].apply(lambda x: x[:len(x) - 6])\n", "df.head()" ], "outputs": [], "metadata": {} }, { "cell_type": "code", "execution_count": null, "source": [ "# Print all days with data\n", "daysWithData = df['occurred_at_day'].unique()\n", "print(daysWithData)" ], "outputs": [], "metadata": {} }, { "cell_type": "code", "execution_count": null, "source": [ "# Filter down to one day, pick the second day in the dataset\n", "df = df[df['occurred_at_day']==daysWithData[1]]\n", "\n", "# Chart the data\n", "fig = px.line(df, x = \"occurred_at\", y=\"value\")\n", "fig.show()" ], "outputs": [], "metadata": {} } ], "metadata": { "interpreter": { "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6" }, "kernelspec": { "name": "python3", "display_name": "Python 3.8.10 64-bit" }, "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.10" } }, "nbformat": 4, "nbformat_minor": 2 }