Need to check Student performance-based on Subject lectures presentation at different locations.
In some cases, Students give presentations from remote locations.
Mathematically Score is like
Student and teacher location were same = (Total of subject_lac * 0.25) / Total of subject_lac
Student and teacher location were Different state = (Total of subject_lac * 0.5) / Total of subject_lac
Student and teacher location were Different Country= (Total of subject_lac * 1) / Total of subject_lac
But some cases same student different locations then multiply with weightage and do average of it Like:
2 subjects in the same location, 3 subjects in Different state, 1 subject Different Country
= (20.25) + (30.5) + (1*1) / 6
DataSet like:
Teacher Teach_Location Student Student_Location Subject_lac
(Country+State) (Country+State)
----------------------------------------------------------------------
T1 AAS S1 AAS X110
T1 AAS S1 AAS X110
T1 AAS S2 AAS X212
T2 LMN S3 LMN X311
T1 AAS S2 AAS X212
T1 AAS S1 OPT X150
T2 LMN S3 LMN X311
T1 AAS S4 AAS X222
T2 LMN S4 LMN X222
T2 LMN S4 LMN X222
T1 AAS S1 OPT X150
T1 AAS S2 AAS X200
T1 AAS S2 OPT X211
T2 LMN S3 OPT X311
T2 LMN S3 OPT X311
data = {'Teacher':['T1', 'T1', 'T1', 'T2', 'T1', 'T1', 'T2', 'T1', 'T2', 'T2', 'T1', 'T1', 'T1', 'T2', 'T2'],
'Tech_location':['AAS','AAS','AAS','LMN','AAS','AAS','LMN','AAS','LMN','LMN','AAS','AAS','AAS','LMN','LMN' ],
'Student':['S1','S1','S2','S3','S2','S1','S3','S2','S4','S4','S1','S2','S2','S3','S3'],
'Student_location':['AAS','AAS','AAS','LMN','AAS','OPT','LMN','AAS','LMN','LMN','OPT','AAS','OPT','OPT','OPT' ],
'Subject':['X110','X110','X212','X311','X212','X150','X311','X222','X222','X222','X150',
'X200','X211','X311','X311'] }
df = pd.DataFrame(data)
Unable to calculate process for multiple location of students where Teacher location same.
For the single location of both teacher and student:
# I Used state and country columns of Student and Trainer for calculating unique count of subjects.
df4 = df1.groupby(['Teacher','Student','Student_Location','Teacher_Location'])['Subject_lac'].nunique().reset_index(name='total_subject')
def location(x):
if x['teacher_country'] != x['Student country']:
return (1 * int(x['total_subject']))/int(x['total_subject'])
elif x['teacher_country'] == x['Student country'] and x['teacher_state'] != x['Student state']:
return (0.75 * int(x['total_subject']))/int(x['total_subject'])
elif x['teacher_country'] == x['Student country'] and x['teacher_state'] == x['Student state']:
return (0.25 * int(x['total_subject']))/int(x['total_subject'])
return ''
df4 ['Student Performance'] = df4 .apply(location, axis=1)
Help me to calculate multiple location performance.
- List item
Aucun commentaire:
Enregistrer un commentaire