Added Front. A few script changes. Jupyter notebooks practice for customer analysis.
This commit is contained in:
409
Scripts/Jupyter/app_usage.ipynb
Normal file
409
Scripts/Jupyter/app_usage.ipynb
Normal file
@ -0,0 +1,409 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 59,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd \n",
|
||||
"import numpy as np \n",
|
||||
"import seaborn as sns \n",
|
||||
"import matplotlib.pylab as plt \n",
|
||||
"import sketch\n",
|
||||
"plt.style.use('ggplot')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 60,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"pages = pd.read_csv(\"/Users/normrasmussen/Downloads/app_usage.csv\", index_col=0, header=0)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 61,
|
||||
"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>Path</th>\n",
|
||||
" <th>Mar 13 - Apr 11</th>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>School Name</th>\n",
|
||||
" <th></th>\n",
|
||||
" <th></th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/courses</td>\n",
|
||||
" <td>25</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/previews</td>\n",
|
||||
" <td>16</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/account_links</td>\n",
|
||||
" <td>11</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/analytics</td>\n",
|
||||
" <td>8</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/settings/general/edit</td>\n",
|
||||
" <td>7</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/apps/integrations</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/accounts/general/edit</td>\n",
|
||||
" <td>4</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/people</td>\n",
|
||||
" <td>3</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/settings/authentication</td>\n",
|
||||
" <td>3</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>/styling/general/edit</td>\n",
|
||||
" <td>2</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" Path Mar 13 - Apr 11\n",
|
||||
"School Name \n",
|
||||
" Vivvix University for Ad Intel /courses 25\n",
|
||||
" Vivvix University for Ad Intel /previews 16\n",
|
||||
" Vivvix University for Ad Intel /account_links 11\n",
|
||||
" Vivvix University for Ad Intel /analytics 8\n",
|
||||
" Vivvix University for Ad Intel /settings/general/edit 7\n",
|
||||
" Vivvix University for Ad Intel /apps/integrations 4\n",
|
||||
" Vivvix University for Ad Intel /accounts/general/edit 4\n",
|
||||
" Vivvix University for Ad Intel /people 3\n",
|
||||
" Vivvix University for Ad Intel /settings/authentication 3\n",
|
||||
" Vivvix University for Ad Intel /styling/general/edit 2"
|
||||
]
|
||||
},
|
||||
"execution_count": 61,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"pages.head(10)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 62,
|
||||
"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>Total Views</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Empty DataFrame\n",
|
||||
"Columns: [Total Views]\n",
|
||||
"Index: []"
|
||||
]
|
||||
},
|
||||
"execution_count": 62,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"pages_sum = pd.DataFrame(columns=['Total Views'])\n",
|
||||
"pages_sum.head()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 63,
|
||||
"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>Total Views</th>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>School Name</th>\n",
|
||||
" <th></th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix University for Ad Intel</th>\n",
|
||||
" <td>110</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>'@properties Academy</th>\n",
|
||||
" <td>322</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4 Pillars Academy</th>\n",
|
||||
" <td>112</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>AIIM+</th>\n",
|
||||
" <td>528</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>ASAPP University</th>\n",
|
||||
" <td>153</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" Total Views\n",
|
||||
"School Name \n",
|
||||
" Vivvix University for Ad Intel 110\n",
|
||||
"'@properties Academy 322\n",
|
||||
"4 Pillars Academy 112\n",
|
||||
"AIIM+ 528\n",
|
||||
"ASAPP University 153"
|
||||
]
|
||||
},
|
||||
"execution_count": 63,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"pages_sum['Total Views'] = pages.groupby(by='School Name')['Mar 13 - Apr 11'].sum()\n",
|
||||
"pages_sum.head(5)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 66,
|
||||
"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>Total Views</th>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>School Name</th>\n",
|
||||
" <th></th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>Vivvix for Ad Intel</th>\n",
|
||||
" <td>110</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>'@properties</th>\n",
|
||||
" <td>322</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4 Pillars</th>\n",
|
||||
" <td>112</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>AIIM+</th>\n",
|
||||
" <td>528</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>ASAPP</th>\n",
|
||||
" <td>153</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>| AgencyBloc</th>\n",
|
||||
" <td>3373</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Académie Évolupharma</th>\n",
|
||||
" <td>253</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Access</th>\n",
|
||||
" <td>11</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>ActiveLearner</th>\n",
|
||||
" <td>1907</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>Ad Intel</th>\n",
|
||||
" <td>2</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" Total Views\n",
|
||||
"School Name \n",
|
||||
" Vivvix for Ad Intel 110\n",
|
||||
"'@properties 322\n",
|
||||
"4 Pillars 112\n",
|
||||
"AIIM+ 528\n",
|
||||
"ASAPP 153\n",
|
||||
" | AgencyBloc 3373\n",
|
||||
"Académie Évolupharma 253\n",
|
||||
"Access 11\n",
|
||||
"ActiveLearner 1907\n",
|
||||
"Ad Intel 2"
|
||||
]
|
||||
},
|
||||
"execution_count": 66,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"to_remove = ['Academy', 'academy', 'University', 'university', 'school', 'School', 'Sandbox', 'Knowledge Base']\n",
|
||||
"for item in pages_sum.itertuples(index=True):\n",
|
||||
" for word in to_remove:\n",
|
||||
" if word in item[0]:\n",
|
||||
" less = item[0].replace(word, '')\n",
|
||||
" pages_sum.rename(index={item[0]:less}, inplace=True)\n",
|
||||
"\n",
|
||||
"pages_sum.head(10)\n",
|
||||
" # if any(element in item[0] for element in to_remove):\n",
|
||||
" # print(item[0])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "jupyter",
|
||||
"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.11.1"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user