From 46bbc7175132f06f965b5ffc08132861913eecae Mon Sep 17 00:00:00 2001 From: Anish Date: Sat, 18 Jan 2020 03:43:20 +1100 Subject: [PATCH] initial commit, some pre-processing for habit data done --- notebook.ipynb | 496 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 496 insertions(+) create mode 100644 notebook.ipynb diff --git a/notebook.ipynb b/notebook.ipynb new file mode 100644 index 0000000..37524e2 --- /dev/null +++ b/notebook.ipynb @@ -0,0 +1,496 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [], + "source": [ + "colNames = ['date', 'check']\n", + "meditateChecks = pd.read_csv('LoopHabits/002 Meditate/Checkmarks.csv', names=colNames, header=None)\n", + "meditateScore = pd.read_csv('LoopHabits/002 Meditate/Scores.csv', names=colNames, header=None)" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": {}, + "outputs": [], + "source": [ + "def only2019(df):\n", + " df['drop'] = df['date'].apply(lambda x: 0 if x[0:4] == '2019' else 1)\n", + " df = df.drop(df[df['drop'] == 1].index)\n", + " df = df.drop(columns=['drop'])\n", + " return df\n", + "\n", + "def onlyMarch(df):\n", + " df['drop'] = df['date'].apply(lambda x: 1 if x[5:7] == '01' or x[5:7] == '02' else 0)\n", + " df = df.drop(df[df['drop'] == 1].index)\n", + " df = df.drop(columns=['drop'])\n", + " return df\n", + "\n", + "def longestZero(df):\n", + " pass\n", + "\n", + "def longestStreak(df):\n", + " pass\n", + "\n", + "def bestMonth(df):\n", + " pass\n", + "\n", + "def worstMonth(df):\n", + " pass\n", + "\n", + "def plotScore(df):\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
datecheck
172019-12-310
182019-12-300
192019-12-290
202019-12-280
212019-12-270
222019-12-260
232019-12-250
242019-12-242
252019-12-231
262019-12-221
272019-12-212
282019-12-202
292019-12-190
302019-12-180
312019-12-170
322019-12-162
332019-12-150
342019-12-140
352019-12-132
362019-12-120
372019-12-110
382019-12-100
392019-12-090
402019-12-080
412019-12-070
422019-12-060
432019-12-050
442019-12-040
452019-12-030
462019-12-020
.........
2932019-03-301
2942019-03-291
2952019-03-282
2962019-03-272
2972019-03-260
2982019-03-250
2992019-03-242
3002019-03-230
3012019-03-221
3022019-03-212
3032019-03-200
3042019-03-192
3052019-03-180
3062019-03-170
3072019-03-162
3082019-03-150
3092019-03-141
3102019-03-132
3112019-03-120
3122019-03-112
3132019-03-100
3142019-03-090
3152019-03-080
3162019-03-070
3172019-03-060
3182019-03-050
3192019-03-040
3202019-03-030
3212019-03-020
3222019-03-010
\n", + "

306 rows × 2 columns

\n", + "
" + ], + "text/plain": [ + " date check\n", + "17 2019-12-31 0\n", + "18 2019-12-30 0\n", + "19 2019-12-29 0\n", + "20 2019-12-28 0\n", + "21 2019-12-27 0\n", + "22 2019-12-26 0\n", + "23 2019-12-25 0\n", + "24 2019-12-24 2\n", + "25 2019-12-23 1\n", + "26 2019-12-22 1\n", + "27 2019-12-21 2\n", + "28 2019-12-20 2\n", + "29 2019-12-19 0\n", + "30 2019-12-18 0\n", + "31 2019-12-17 0\n", + "32 2019-12-16 2\n", + "33 2019-12-15 0\n", + "34 2019-12-14 0\n", + "35 2019-12-13 2\n", + "36 2019-12-12 0\n", + "37 2019-12-11 0\n", + "38 2019-12-10 0\n", + "39 2019-12-09 0\n", + "40 2019-12-08 0\n", + "41 2019-12-07 0\n", + "42 2019-12-06 0\n", + "43 2019-12-05 0\n", + "44 2019-12-04 0\n", + "45 2019-12-03 0\n", + "46 2019-12-02 0\n", + ".. ... ...\n", + "293 2019-03-30 1\n", + "294 2019-03-29 1\n", + "295 2019-03-28 2\n", + "296 2019-03-27 2\n", + "297 2019-03-26 0\n", + "298 2019-03-25 0\n", + "299 2019-03-24 2\n", + "300 2019-03-23 0\n", + "301 2019-03-22 1\n", + "302 2019-03-21 2\n", + "303 2019-03-20 0\n", + "304 2019-03-19 2\n", + "305 2019-03-18 0\n", + "306 2019-03-17 0\n", + "307 2019-03-16 2\n", + "308 2019-03-15 0\n", + "309 2019-03-14 1\n", + "310 2019-03-13 2\n", + "311 2019-03-12 0\n", + "312 2019-03-11 2\n", + "313 2019-03-10 0\n", + "314 2019-03-09 0\n", + "315 2019-03-08 0\n", + "316 2019-03-07 0\n", + "317 2019-03-06 0\n", + "318 2019-03-05 0\n", + "319 2019-03-04 0\n", + "320 2019-03-03 0\n", + "321 2019-03-02 0\n", + "322 2019-03-01 0\n", + "\n", + "[306 rows x 2 columns]" + ] + }, + "execution_count": 88, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "onlyMarch(only2019(meditateChecks))" + ] + } + ], + "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.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}