-
Notifications
You must be signed in to change notification settings - Fork 1
/
load.py
49 lines (40 loc) · 2 KB
/
load.py
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
from pandas import DataFrame,read_excel,read_csv
from numpy import float64, nan
def base_load_template(File = 'static/base_TPL_assessment.xlsx'):
indexCols = ['Broad Capability','Narrow Capability','Specific Capability','Question Group Description']
tplAssessment = read_excel(File)
tplAssessment.set_index(indexCols,inplace=True)
#print(tplAssessment.loc)
return tplAssessment
def standard_load_assessment(File = 'static/base_TPL_assessment.xlsx'):
return read_excel(File)
def cache_create_template(File = 'static/base_TPL_assessment.xlsx'):
base = read_excel(File)
userDF = base.loc[:,('Broad Capability','Narrow Capability','Specific Capability','Question Group Description')]
userDF['Score'] = float64(base['Score'])
userDF['Weight'] = float64(base['Weight'])
userDF['SpecCap Weight'] = float64(base['SpecCap Weight'])
userDF['RW'] = nan
userDF['Input Score'] = userDF['Score']*userDF['Weight']
userDF['Contribution'] = userDF['Input Score']*userDF['RW']
userDF['Net'] = nan
userDF['Threshold'] = float64(base['Threshold'])
return userDF
def create_user_template(base,sid):
userDF = base.loc[:,('Broad Capability','Narrow Capability','Specific Capability','Question Group Description')]
userDF['Score'] = float64(base['Score'])
userDF['Weight'] = float64(base['Weight'])
userDF['SpecCap Weight'] = float64(base['SpecCap Weight'])
userDF['RW'] = nan
userDF['Input Score'] = userDF['Score']*userDF['Weight']
userDF['Contribution'] = userDF['Input Score']*userDF['RW']
userDF['Net'] = nan
userDF['Threshold'] = float64(base['Threshold'])
userDF.to_csv(f'./static/userDF-{sid}.csv')
def load_user_template(sid):
#indexCols = ['Broad Capability','Narrow Capability','Specific Capability']
userAssessment = read_csv(f'./static/userDF-{sid}.csv')
#userAssessment.set_index(indexCols,inplace=True)
return userAssessment
def save_user_template(userTemplate,sid):
userTemplate.to_csv(f'./static/userDF-{sid}.csv')