-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivityReport.py
More file actions
86 lines (67 loc) · 4.02 KB
/
activityReport.py
File metadata and controls
86 lines (67 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Nicolas Romano
# July 16, 2021
# End of Semester Activity Report Script
# This script will read in the activities data at the end of each semester
# and export a .csv file with key statistics pertaining to the data.
import pandas as pd
def runActivityReport(cohort_list, actData, results):
#############################################
# Setting the Cohort Labels: #
#############################################
for ind in results.index:
results["Cohort"][ind] = cohort_list[ind]
#############################################
# Set the cohort sizes: #
#############################################
for ind in results.index:
results["Total # of Active Students"][ind] = (actData[actData['Cohort'] == cohort_list[ind]]['Cohort'].count())
results["Total # of Active Students"][0] = len(actData) # Update the total size
#############################################
# Total Activities Completed: #
#############################################
for ind in results.index:
results["Total # of Activities completed"][ind] = actData[actData['Cohort'] == cohort_list[ind]]['Activities Count'].sum()
results["Total # of Activities completed"][0] = actData["Activities Count"].sum()
#############################################
# Proportion of Activities to Students: #
#############################################
for ind in results.index:
results["Proportion of Activites to Students"][ind] = round(results["Total # of Activities completed"][ind]/results["Total # of Active Students"][ind], 2)
#############################################
# Total Service Completed: #
#############################################
for ind in results.index:
results["# of Service Activities completed"][ind] = actData[actData['Cohort'] == cohort_list[ind]]['service count'].sum()
results["# of Service Activities completed"][0] = actData["service count"].sum()
#############################################
# % completed (Service) #
#############################################
for ind in results.index:
results["% completed (Service)"][ind] = 100*round(results["# of Service Activities completed"][ind]/results["Total # of Activities completed"][ind], 3)
#############################################
# Total Civ-Mil Completed: #
#############################################
for ind in results.index:
results["# of Civ-Mil Activities completed"][ind] = actData[actData['Cohort'] == cohort_list[ind]]['civ mil count'].sum()
results["# of Civ-Mil Activities completed"][0] = actData["civ mil count"].sum()
#############################################
# % completed (Civ-Mil) #
#############################################
for ind in results.index:
results["% completed (Civ-Mil)"][ind] = 100*round(results["# of Civ-Mil Activities completed"][ind]/results["Total # of Activities completed"][ind], 3)
#############################################
# Total Culture Completed: #
#############################################
for ind in results.index:
results["# of Culture Activities completed"][ind] = actData[actData['Cohort'] == cohort_list[ind]]['culture count'].sum()
results["# of Culture Activities completed"][0] = actData["culture count"].sum()
#############################################
# % completed (Civ-Mil) #
#############################################
for ind in results.index:
results["% completed (Culture)"][ind] = 100 * round(results["# of Culture Activities completed"][ind] / results["Total # of Activities completed"][ind], 3)
return results
# activities = pd.read_csv('activities2.csv')
# results_template = pd.read_csv('../static/ReportTemplate.csv')
# c_list = ['All', '2', '3', '4', '5', 'T2', 'T3']
# runActivityReport(c_list, activities, results_template)