Notes from SPS,Keystone,Walmart, and Glassdoor. Changed some templates in my sandbox.

This commit is contained in:
Norm Rasmussen
2023-04-25 18:19:08 -04:00
parent 9c723283ff
commit c78cf84753
12 changed files with 317 additions and 86 deletions

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 25,
"metadata": {},
"outputs": [
{
@ -30,19 +30,20 @@
"dtype: object"
]
},
"execution_count": 35,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pageviews = pd.read_csv(\"/Users/normrasmussen/Documents/Work/Data/GraphQuery (4).csv\")\n",
"pd.set_option('display.max_rows', 100)\n",
"pageviews = pd.read_csv(\"/Users/normrasmussen/Documents/Work/Data/GraphQuery (4).csv\", index_col=None)\n",
"pageviews.dtypes"
]
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 26,
"metadata": {},
"outputs": [
{
@ -210,7 +211,7 @@
"[123 rows x 5 columns]"
]
},
"execution_count": 36,
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
@ -228,7 +229,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
@ -242,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 23,
"metadata": {},
"outputs": [
{
@ -286,7 +287,7 @@
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">'@properties Academy</th>\n",
" <th rowspan=\"8\" valign=\"top\">'@properties Academy</th>\n",
" <th>/account_links</th>\n",
" <td>8</td>\n",
" </tr>\n",
@ -299,62 +300,195 @@
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"5\" valign=\"top\">ActiveLearner</th>\n",
" <th>/courses/cgivmko2/builder/activities/QNpmEsyHk</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/courses/cgivmko2/builder/activities/Rh6JL0L9U</th>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/courses/cgivmko2/builder/activities/T0kIBCfZt</th>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/courses/cgivmko2/builder/activities/ZG38aHRFcX</th>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/courses</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/courses/cgivmko2/builder/activities/_Jtk3s0pt</th>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships</th>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships/new</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/instructor_led_trainings</th>\n",
" <td>11</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>100 rows × 1 columns</p>\n",
"</div>"
],
"text/plain": [
" apr_week\n",
"academy path \n",
" Vivvix University for Ad Intel /account_links 1\n",
" /courses 1\n",
"'@properties Academy /account_links 8\n",
" /courses 11\n",
" /groups 4\n",
"... ...\n",
"ActiveLearner /courses/cgivmko2/builder/activities/QNpmEsyHk 2\n",
" /courses/cgivmko2/builder/activities/Rh6JL0L9U 5\n",
" /courses/cgivmko2/builder/activities/T0kIBCfZt 5\n",
" /courses/cgivmko2/builder/activities/ZG38aHRFcX 1\n",
" /courses/cgivmko2/builder/activities/_Jtk3s0pt 1\n",
"\n",
"[100 rows x 1 columns]"
" apr_week\n",
"academy path \n",
" Vivvix University for Ad Intel /account_links 1\n",
" /courses 1\n",
"'@properties Academy /account_links 8\n",
" /courses 11\n",
" /groups 4\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/co... 1\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit 1\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 8\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 3\n",
" /instructor_led_trainings 11"
]
},
"execution_count": 41,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pageviews = pageviews.groupby(['academy', 'path']).agg({'apr_week':'sum'})\n",
"pageviews.head(100)"
"#pageviews = pageviews.groupby(['academy', 'path']).agg({'apr_week':'sum'})\n",
"#pageviews.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"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></th>\n",
" <th>apr_week</th>\n",
" </tr>\n",
" <tr>\n",
" <th>academy</th>\n",
" <th>path</th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"2\" valign=\"top\">Vivvix University for Ad Intel</th>\n",
" <th>/account_links</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/courses</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"8\" valign=\"top\">'@properties Academy</th>\n",
" <th>/account_links</th>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/courses</th>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/groups</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/courses</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships</th>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/memberships/new</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>/instructor_led_trainings</th>\n",
" <td>11</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" apr_week\n",
"academy path \n",
" Vivvix University for Ad Intel /account_links 1\n",
" /courses 1\n",
"'@properties Academy /account_links 8\n",
" /courses 11\n",
" /groups 4\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/co... 1\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/edit 1\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 8\n",
" /groups/2a09819b-a19a-4e87-91c6-8b50ee3c46f8/me... 3\n",
" /instructor_led_trainings 11"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pageviews.reset_index\n",
"pageviews.head(10)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 True\n",
"1 True\n",
"2 True\n",
"3 True\n",
"4 False\n",
" ... \n",
"13861 True\n",
"13862 True\n",
"13863 False\n",
"13864 False\n",
"13865 False\n",
"Name: path, Length: 13866, dtype: bool"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"startswith_list = ('/courses', '/people', 'learning_paths', '/instructor_led_trainings', '/preview', '/groups', '/account_links')\n",
"#for root in startswith_list:\n",
"# pageviews.path.str.startswith(root, na=False)\n",
" #pageviews['root'] = pageviews.path.apply(lambda x: root if pageviews.path.str.startswith(root, na=False) else 'None')\n",
"\n",
"pageviews.path.str.startswith(startswith_list)"
]
},
{