datalife-2019/notebook.ipynb

497 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"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": [
"<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>date</th>\n",
" <th>check</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>2019-12-31</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>2019-12-30</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>2019-12-29</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>2019-12-28</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>2019-12-27</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>2019-12-26</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>2019-12-25</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>2019-12-24</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>2019-12-23</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>2019-12-22</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>2019-12-21</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>2019-12-20</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>2019-12-19</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>2019-12-18</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>2019-12-17</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>2019-12-16</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
" <td>2019-12-15</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
" <td>2019-12-14</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>2019-12-13</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
" <td>2019-12-12</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
" <td>2019-12-11</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
" <td>2019-12-10</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>39</th>\n",
" <td>2019-12-09</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>40</th>\n",
" <td>2019-12-08</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
" <td>2019-12-07</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>2019-12-06</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43</th>\n",
" <td>2019-12-05</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44</th>\n",
" <td>2019-12-04</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>45</th>\n",
" <td>2019-12-03</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>46</th>\n",
" <td>2019-12-02</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>293</th>\n",
" <td>2019-03-30</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>294</th>\n",
" <td>2019-03-29</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>295</th>\n",
" <td>2019-03-28</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>296</th>\n",
" <td>2019-03-27</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>297</th>\n",
" <td>2019-03-26</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>298</th>\n",
" <td>2019-03-25</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>299</th>\n",
" <td>2019-03-24</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>300</th>\n",
" <td>2019-03-23</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>301</th>\n",
" <td>2019-03-22</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>302</th>\n",
" <td>2019-03-21</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>303</th>\n",
" <td>2019-03-20</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>304</th>\n",
" <td>2019-03-19</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>305</th>\n",
" <td>2019-03-18</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>306</th>\n",
" <td>2019-03-17</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>307</th>\n",
" <td>2019-03-16</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>308</th>\n",
" <td>2019-03-15</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>309</th>\n",
" <td>2019-03-14</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>310</th>\n",
" <td>2019-03-13</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>311</th>\n",
" <td>2019-03-12</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>312</th>\n",
" <td>2019-03-11</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>313</th>\n",
" <td>2019-03-10</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>314</th>\n",
" <td>2019-03-09</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>315</th>\n",
" <td>2019-03-08</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>316</th>\n",
" <td>2019-03-07</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>317</th>\n",
" <td>2019-03-06</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>318</th>\n",
" <td>2019-03-05</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>319</th>\n",
" <td>2019-03-04</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>320</th>\n",
" <td>2019-03-03</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>321</th>\n",
" <td>2019-03-02</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>322</th>\n",
" <td>2019-03-01</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>306 rows × 2 columns</p>\n",
"</div>"
],
"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
}