selfstats/Untitled.ipynb

95 lines
78 KiB
Text
Raw Normal View History

2023-03-18 23:42:45 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 34,
"id": "067b9e86-c8f2-41c6-9f3c-3df26976962a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"15:03:00 1:47:00\n"
]
},
{
"data": {
"text/plain": [
"<Axes: xlabel='date', ylabel='sleep_time'>"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAGwCAYAAACtlb+kAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAA9hAAAPYQGoP6dpAADihElEQVR4nOy9eZwdVZk+/tRde++ks3TTEEiAsAYUQZG4gBJgVAS/OIMjOoMjzhd/KGMUBmWYJeMSRhyBMczgV2UEYZAZF5zNBVCMRkRiECGIJECABNJ0lt6Xu9bvj7rn1HtOnapbVbfqbn2ezyefTt+ue2+t57zneZ/3eQ3TNE1oaGhoaGhoaLQxEo3eAQ0NDQ0NDQ2NuKEDHg0NDQ0NDY22hw54NDQ0NDQ0NNoeOuDR0NDQ0NDQaHvogEdDQ0NDQ0Oj7aEDHg0NDQ0NDY22hw54NDQ0NDQ0NNoeqUbvQDOgXC7j5ZdfRm9vLwzDaPTuaGhoaGhoaPiAaZqYmprC8PAwEglvDkcHPABefvllrFixotG7oaGhoaGhoRECu3fvxmGHHea5jQ54APT29gKwTlhfX1+D90ZDQ0NDQ0PDDyYnJ7FixQo+j3tBBzwAT2P19fXpgEdDQ0NDQ6PF4EeOokXLGhoaGhoaGm0PHfBoaGhoaGhotD10wKOhoaGhoaHR9tABj4aGhoaGhkbbQwc8GhoaGhoaGm0PHfBoaGhoaGhotD10wKOhoaGhoaHR9tABj4aGhoaGhkbbQwc8GhoaGhoaGm0PHfBoaG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sLul6xFKIzroKq2FCRbwaA1P60IHPBptC208qBEHtIZnYYItnPQlb13ogEejbcEGJp120IgSlDHUvbQWDtgwohdQrYuGBjzFYhF//dd/jVWrVqGzsxNHHnkkPv3pT6NctkUXpmliw4YNGB4eRmdnJ8466yw8+eSTwufkcjlceeWVWLp0Kbq7u3HBBRdgz5499T4cjSaDTmlpxAF6O+l7a+FAV322Phoa8Hz+85/Hl7/8Zdxyyy146qmncMMNN+ALX/gCNm3axLe54YYbcOONN+KWW27B1q1bMTQ0hHPOOQdTU1N8m/Xr1+Pee+/FPffcgy1btmB6ehrnn38+SqVSIw5Lo0lQ0hS0RgygjKFmeBYOSlzD0+Ad0QiNVCO//Je//CUuvPBCvOMd7wAArFy5Et/85jfx61//GoC1Qr/55ptx3XXX4aKLLgIA3HHHHRgcHMTdd9+Nyy+/HBMTE7jttttw5513Yt26dQCAu+66CytWrMADDzyA8847z/G9uVwOuVyO/z45ORn3oWo0ADylpScljQhBV/h6tb9wUNYprZZHQxmeN77xjfjxj3+MHTt2AAB++9vfYsuWLXj7298OANi1axdGRkZw7rnn8vdks1mceeaZeOihhwAA27ZtQ6FQELYZHh7GmjVr+DYyrr/+evT39/N/K1asiOsQNRoIXVWhEQcEDY/ulr5gYOqy9JZHQxmeT37yk5iYmMBxxx2HZDKJUqmEz33uc3jve98LABgZsTrTDg4OCu8bHBzECy+8wLfJZDJYvHixYxv2fhnXXnstPvGJT/DfJycnddDThmATkxYta0QJQcOj760FA83wtD4aGvD8+7//O+666y7cfffdOPHEE/HYY49h/fr1GB4exqWXXsq3MwxDeJ9pmo7XZHhtk81mkc1maz8AjaaGndJq7H5otBdKQpWWvrkWCjRj3PpoaMDzl3/5l/jUpz6FP/7jPwYAnHTSSXjhhRdw/fXX49JLL8XQ0BAAi8U55JBD+PtGR0c56zM0NIR8Po+xsTGB5RkdHcXatWvreDQazQY9QGnEAVPw4WngjmjUDaZpkrL0xu6LRng0VMMzOzuLRELchWQyycv
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"PATH = \"watch-data/SLEEP/SLEEP_1679159561556.csv\"\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"import datetime\n",
"fmtdelta = lambda td: str(datetime.timedelta(minutes = int(td)))\n",
"\n",
"df = pd.read_csv(PATH, escapechar='\\\\', parse_dates=['start', 'stop', 'date'])\n",
"df['sleep_time'] = df['deepSleepTime'] + df['shallowSleepTime'] + df['REMTime']\n",
"df = df[df.sleep_time > 0]\n",
"print(fmtdelta(df.sleep_time.max()), fmtdelta(df.sleep_time.min()))\n",
"sns.lineplot(df, x = 'date', y = 'sleep_time')"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "918c73b9-1036-41a6-89cb-21a741ba7bea",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"('2:24:30.397921', '6:15:56.393443')"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fmtdelta(df.sleep_time.std()), fmtdelta(df.sleep_time.mean())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}