diff --git a/config/environment.yml b/config/environment.yml
index 4ff921d..d0d9b66 100644
--- a/config/environment.yml
+++ b/config/environment.yml
@@ -13,4 +13,5 @@ dependencies:
- psycopg2
- python-dotenv
- seaborn
- - sqlalchemy
\ No newline at end of file
+ - sqlalchemy
+ - tabulate
\ No newline at end of file
diff --git a/exploration/screen.ipynb b/exploration/screen.ipynb
index c69682c..c903116 100644
--- a/exploration/screen.ipynb
+++ b/exploration/screen.ipynb
@@ -7,6 +7,7 @@
"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)"
@@ -91,13 +92,18 @@
"outputs": [
{
"data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "off | 70243 |
\n",
+ "on | 70012 |
\n",
+ "locked | 63080 |
\n",
+ "unlocked | 36666 |
\n",
+ "\n",
+ "
"
+ ],
"text/plain": [
- "screen_status\n",
- "0 70243\n",
- "1 70012\n",
- "2 63080\n",
- "3 36666\n",
- "dtype: int64"
+ "'\\n\\noff | 70243 |
\\non | 70012 |
\\nlocked | 63080 |
\\nunlocked | 36666 |
\\n\\n
'"
]
},
"execution_count": 6,
@@ -106,7 +112,121 @@
}
],
"source": [
- "df_screen_inactive.value_counts(\"screen_status\")"
+ "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": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " screen_status | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " -1.0 | \n",
+ " 810 | \n",
+ "
\n",
+ " \n",
+ " 2.0 | \n",
+ " 779 | \n",
+ "
\n",
+ " \n",
+ " -3.0 | \n",
+ " 238 | \n",
+ "
\n",
+ " \n",
+ " 1.0 | \n",
+ " 44 | \n",
+ "
\n",
+ " \n",
+ " -2.0 | \n",
+ " 38 | \n",
+ "
\n",
+ " \n",
+ " 0.0 | \n",
+ " 6 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "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*)."
]
}
],
@@ -126,7 +246,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.2"
+ "version": "3.9.4"
}
},
"nbformat": 4,