Skip to content

Commit 1e4ff49

Browse files
authored
Refactor: hours summarize notebook (#22)
2 parents 5fd253c + f003cdb commit 1e4ff49

File tree

3 files changed

+112
-180
lines changed

3 files changed

+112
-180
lines changed

notebooks/summarize-harvest.ipynb

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import os\n",
10+
"import pandas as pd"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": null,
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"data = os.environ[\"HARVEST_DATA\"]\n",
20+
"df = pd.read_csv(data.removeprefix(\"notebooks/\"))"
21+
]
22+
},
23+
{
24+
"cell_type": "code",
25+
"execution_count": null,
26+
"metadata": {},
27+
"outputs": [],
28+
"source": [
29+
"df.info()"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"df[\"Date\"].min()"
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": null,
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"df[\"Date\"].max()"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"metadata": {},
54+
"outputs": [],
55+
"source": [
56+
"df[\"Hours\"].sum()"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": null,
62+
"metadata": {},
63+
"outputs": [],
64+
"source": [
65+
"groupby = df.groupby([\"Project\"])\n",
66+
"\n",
67+
"for group in groupby.groups:\n",
68+
" group_df = groupby.get_group((group, ))\n",
69+
" sum = group_df[\"Hours\"].sum()\n",
70+
"\n",
71+
" print(f\"{group}: {sum}\")"
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": null,
77+
"metadata": {},
78+
"outputs": [],
79+
"source": [
80+
"groupby = df.groupby([\"First name\", \"Last name\", \"Project\"])\n",
81+
"\n",
82+
"for group in groupby.groups:\n",
83+
" group_df = groupby.get_group(group)\n",
84+
" sum = group_df[\"Hours\"].sum()\n",
85+
"\n",
86+
" print(f\"{group}: {sum}\")"
87+
]
88+
}
89+
],
90+
"metadata": {
91+
"kernelspec": {
92+
"display_name": "Python 3",
93+
"language": "python",
94+
"name": "python3"
95+
},
96+
"language_info": {
97+
"codemirror_mode": {
98+
"name": "ipython",
99+
"version": 3
100+
},
101+
"file_extension": ".py",
102+
"mimetype": "text/x-python",
103+
"name": "python",
104+
"nbconvert_exporter": "python",
105+
"pygments_lexer": "ipython3",
106+
"version": "3.11.6"
107+
}
108+
},
109+
"nbformat": 4,
110+
"nbformat_minor": 2
111+
}

notebooks/verify-harvest.ipynb

Lines changed: 0 additions & 179 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
]
1212
requires-python = ">=3.11"
1313
dependencies = [
14-
"advanced-gam-for-google-workspace @ git+https://github.com/taers232c/GAMADV-XTD3.git@v6.71.15#subdirectory=src",
14+
"advanced-gam-for-google-workspace @ git+https://github.com/taers232c/GAMADV-XTD3.git@v6.76.12#subdirectory=src",
1515
"pandas==2.2.2",
1616
]
1717

0 commit comments

Comments
 (0)