Remove Jupyter Notebooks as they will be versioned as py scripts from now on.

communication
junos 2021-05-07 12:15:00 +02:00
parent 10bdc8aa1d
commit d5056d9b2f
3 changed files with 1 additions and 1211 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
*/.ipynb_checkpoints/ */.ipynb_checkpoints/
__pycache__/ __pycache__/
*/__pycache__/ */__pycache__/
/exploration/*.ipynb

File diff suppressed because one or more lines are too long

View File

@ -1,257 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os, sys\n",
"from tabulate import tabulate\n",
"nb_dir = os.path.split(os.getcwd())[0]\n",
"if nb_dir not in sys.path:\n",
" sys.path.append(nb_dir)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from features.screen import *\n",
"import participants.query_db"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"df_screen_nokia = get_screen_data([\"nokia_0000003\"])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" id _id timestamp device_id \\\n",
"0 245456 155 1615456297079 12324354-e195-4e93-a2d5-268556e3ea5d \n",
"1 245455 154 1615456297069 12324354-e195-4e93-a2d5-268556e3ea5d \n",
"2 245454 153 1615456288219 12324354-e195-4e93-a2d5-268556e3ea5d \n",
"3 245453 152 1615455357213 12324354-e195-4e93-a2d5-268556e3ea5d \n",
"4 245452 151 1615455357190 12324354-e195-4e93-a2d5-268556e3ea5d \n",
"... ... ... ... ... \n",
"1911 33221 5 1583329949659 d5fb52e1-7df8-44b5-a805-8d04ca008061 \n",
"1912 33171 4 1583327341863 d5fb52e1-7df8-44b5-a805-8d04ca008061 \n",
"1913 33170 3 1583327340983 d5fb52e1-7df8-44b5-a805-8d04ca008061 \n",
"1914 33169 2 1583327340739 d5fb52e1-7df8-44b5-a805-8d04ca008061 \n",
"1915 33168 1 1583327340713 d5fb52e1-7df8-44b5-a805-8d04ca008061 \n",
"\n",
" screen_status participant_id username \n",
"0 2 21 nokia_0000003 \n",
"1 0 21 nokia_0000003 \n",
"2 1 21 nokia_0000003 \n",
"3 2 21 nokia_0000003 \n",
"4 0 21 nokia_0000003 \n",
"... ... ... ... \n",
"1911 3 21 nokia_0000003 \n",
"1912 3 21 nokia_0000003 \n",
"1913 1 21 nokia_0000003 \n",
"1914 2 21 nokia_0000003 \n",
"1915 0 21 nokia_0000003 \n",
"\n",
"[1916 rows x 7 columns]\n"
]
}
],
"source": [
"print(df_screen_nokia)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"participants_inactive_usernames = participants.query_db.get_usernames()\n",
"df_screen_inactive = get_screen_data(participants_inactive_usernames)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<tbody>\n",
"<tr><td>off </td><td style=\"text-align: right;\">70243</td></tr>\n",
"<tr><td>on </td><td style=\"text-align: right;\">70012</td></tr>\n",
"<tr><td>locked </td><td style=\"text-align: right;\">63080</td></tr>\n",
"<tr><td>unlocked</td><td style=\"text-align: right;\">36666</td></tr>\n",
"</tbody>\n",
"</table>"
],
"text/plain": [
"'<table>\\n<tbody>\\n<tr><td>off </td><td style=\"text-align: right;\">70243</td></tr>\\n<tr><td>on </td><td style=\"text-align: right;\">70012</td></tr>\\n<tr><td>locked </td><td style=\"text-align: right;\">63080</td></tr>\\n<tr><td>unlocked</td><td style=\"text-align: right;\">36666</td></tr>\\n</tbody>\\n</table>'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_screen_inactive[\"screen_status\"] = df_screen_inactive[\"screen_status\"].astype(\"category\").cat.rename_categories(screen_status)\n",
"screen_freq = df_screen_inactive.value_counts(\"screen_status\")\n",
"tabulate(screen_freq.to_frame(), tablefmt='html')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{0: 'off', 1: 'on', 2: 'locked', 3: 'unlocked'}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"screen_status"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A typical sequence might be: off -> locked -> on -> unlocked (0 -> 2 -> 1 -> 3)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"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>screen_status</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>-1.0</th>\n",
" <td>810</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2.0</th>\n",
" <td>779</td>\n",
" </tr>\n",
" <tr>\n",
" <th>-3.0</th>\n",
" <td>238</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1.0</th>\n",
" <td>44</td>\n",
" </tr>\n",
" <tr>\n",
" <th>-2.0</th>\n",
" <td>38</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0.0</th>\n",
" <td>6</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" screen_status\n",
"-1.0 810\n",
" 2.0 779\n",
"-3.0 238\n",
" 1.0 44\n",
"-2.0 38\n",
" 0.0 6"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"status_diff = df_screen_nokia.sort_values(\"timestamp\")[\"screen_status\"].diff()\n",
"status_diff.value_counts().to_frame()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"But I have also seen off -> on -> unlocked (with 2 - locked missing) and off -> locked -> on -> off -> locked (*again*)."
]
}
],
"metadata": {
"jupytext": {
"formats": "ipynb,auto:percent"
},
"kernelspec": {
"display_name": "straw2analysis",
"language": "python",
"name": "straw2analysis"
},
"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.9.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}