#-*- coding:utf-8 -*-

'''
# Author: chenhao
# Date: March. 22
# Description: Data-process for Education visualization competition
'''

##############################################################################
#Part3：统计老师整体实力
##############################################################################

import pandas as pd
import json

filepath_teacherInfo = '../../education_data/1_teacher.csv'

filepath_studentsInfo = '../../education_data/2_student_info.csv'

filepath_score = '../../education_data/5_chengji.csv'

filepath_score_merge_studentid = '../../education_data/CH/5.chengji_3_claID/5.chengji_3_claID.csv'
##############################################################################
# Step: 统计学科的教师情况

class_id = [901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941]
# class_score = [[80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0], [81.519999999999996, 85.849999999999994, 83.450000000000003, 85.069999999999993, 82.680000000000007, 83.870000000000005, 0, 82.909999999999997, 89.730000000000004], [82.469999999999999, 84.269999999999996, 82.709999999999994, 83.599999999999994, 85.290000000000006, 84.530000000000001, 82.599999999999994, 82.430000000000007, 83.209999999999994], [79.390000000000001, 80.640000000000001, 80.700000000000003, 77.680000000000007, 80.370000000000005, 80.010000000000005, 82.510000000000005, 78.489999999999995, 78.969999999999999], [80.299999999999997, 80.659999999999997, 80.079999999999998, 78.909999999999997, 79.790000000000006, 78.739999999999995, 74.969999999999999, 80.650000000000006, 82.469999999999999], [80.459999999999994, 80.269999999999996, 81.790000000000006, 83.109999999999999, 79.579999999999998, 78.849999999999994, 80.400000000000006, 79.590000000000003, 78.299999999999997], [80.659999999999997, 80.760000000000005, 83.459999999999994, 81.079999999999998, 80.730000000000004, 80.659999999999997, 79.150000000000006, 82.519999999999996, 79.439999999999998], [84.269999999999996, 81.379999999999995, 81.409999999999997, 82.189999999999998, 82.090000000000003, 83.870000000000005, 84.069999999999993, 84.260000000000005, 80.430000000000007], [78.739999999999995, 76.859999999999999, 78.340000000000003, 74.780000000000001, 75.780000000000001, 78.829999999999998, 78.799999999999997, 77.760000000000005, 80.560000000000002], [82.069999999999993, 76.480000000000004, 82.109999999999999, 78.689999999999998, 78.340000000000003, 82.159999999999997, 79.829999999999998, 79.090000000000003, 81.370000000000005], [72.930000000000007, 76.989999999999995, 67.859999999999999, 75.379999999999995, 73.599999999999994, 72.590000000000003, 75.230000000000004, 74.890000000000001, 75.269999999999996], [72.650000000000006, 72.359999999999999, 70.640000000000001, 73.189999999999998, 73.010000000000005, 70.849999999999994, 77.879999999999995, 73.969999999999999, 76.409999999999997], [82.340000000000003, 86.349999999999994, 0, 0, 0, 0, 0, 0, 0], [77.969999999999999, 78.680000000000007, 0, 0, 0, 0, 0, 0, 0], [77.310000000000002, 79.239999999999995, 0, 0, 0, 0, 0, 0, 0], [77.739999999999995, 80.290000000000006, 0, 0, 0, 0, 0, 0, 0], [78.409999999999997, 76.810000000000002, 0, 0, 0, 0, 0, 0, 0], [81.420000000000002, 84.019999999999996, 0, 0, 0, 0, 0, 0, 0], [77.049999999999997, 77.939999999999998, 0, 0, 0, 0, 0, 0, 0], [82.319999999999993, 78.859999999999999, 0, 0, 0, 0, 0, 0, 0], [81.780000000000001, 78.609999999999999, 0, 0, 0, 0, 0, 0, 0], [84.310000000000002, 79.170000000000002, 0, 0, 0, 0, 0, 0, 0], [82.049999999999997, 84.659999999999997, 84.680000000000007, 83.650000000000006, 83.549999999999997, 81.439999999999998, 84.140000000000001, 82.640000000000001, 82.299999999999997], [83.099999999999994, 84.180000000000007, 83.379999999999995, 84.420000000000002, 83.180000000000007, 83.359999999999999, 83.109999999999999, 83.609999999999999, 81.060000000000002], [83.510000000000005, 86.280000000000001, 84.489999999999995, 85.650000000000006, 83.299999999999997, 84.519999999999996, 83.370000000000005, 84.510000000000005, 82.040000000000006], [81.200000000000003, 83.329999999999998, 83.760000000000005, 84.650000000000006, 86.120000000000005, 83.700000000000003, 82.450000000000003, 85.420000000000002, 81.840000000000003], [81.390000000000001, 82.719999999999999, 81.219999999999999, 82.069999999999993, 82.599999999999994, 82.430000000000007, 81.260000000000005, 82.459999999999994, 78.200000000000003], [80.719999999999999, 82.0, 82.129999999999995, 81.969999999999999, 79.799999999999997, 82.489999999999995, 83.049999999999997, 81.109999999999999, 82.700000000000003], [86.0, 81.599999999999994, 82.260000000000005, 79.099999999999994, 80.780000000000001, 83.700000000000003, 84.519999999999996, 81.560000000000002, 80.609999999999999], [87.420000000000002, 81.650000000000006, 86.959999999999994, 82.519999999999996, 82.719999999999999, 85.480000000000004, 87.859999999999999, 83.920000000000002, 83.370000000000005], [77.040000000000006, 75.760000000000005, 76.620000000000005, 76.950000000000003, 76.920000000000002, 77.849999999999994, 74.739999999999995, 78.469999999999999, 79.159999999999997], [78.310000000000002, 76.340000000000003, 76.209999999999994, 75.799999999999997, 77.069999999999993, 77.719999999999999, 78.75, 75.900000000000006, 77.870000000000005], [76.459999999999994, 78.75, 78.269999999999996, 79.879999999999995, 78.790000000000006, 76.480000000000004, 76.400000000000006, 79.870000000000005, 80.140000000000001], [75.640000000000001, 79.379999999999995, 77.909999999999997, 78.920000000000002, 79.200000000000003, 77.540000000000006, 78.530000000000001, 75.909999999999997, 79.659999999999997], [78.409999999999997, 75.579999999999998, 78.540000000000006, 76.599999999999994, 78.269999999999996, 77.819999999999993, 76.090000000000003, 79.319999999999993, 78.430000000000007], [81.439999999999998, 77.840000000000003, 79.879999999999995, 75.010000000000005, 78.120000000000005, 79.209999999999994, 81.140000000000001, 76.379999999999995, 80.989999999999995], [70.849999999999994, 77.409999999999997, 69.689999999999998, 79.079999999999998, 75.680000000000007, 70.079999999999998, 70.209999999999994, 73.109999999999999, 74.129999999999995], [74.530000000000001, 72.909999999999997, 71.459999999999994, 75.030000000000001, 72.859999999999999, 74.670000000000002, 72.599999999999994, 75.049999999999997, 75.879999999999995]]
# class_score = [[0.51000000000000001, 0.51000000000000001, 0.51000000000000001, 0.51000000000000001, 0.51000000000000001, 0.51000000000000001, 0.59999999999999998, 0.51000000000000001, 1.0], [0.42999999999999999, 0.27000000000000002, 0.37, 0.29999999999999999, 0.40000000000000002, 0.35999999999999999, 0, 0.39000000000000001, 0.13], [0.41999999999999998, 0.34000000000000002, 0.40000000000000002, 0.38, 0.31, 0.33000000000000002, 0.40999999999999998, 0.40999999999999998, 0.40000000000000002], [0.53000000000000003, 0.48999999999999999, 0.5, 0.59999999999999998, 0.51000000000000001, 0.51000000000000001, 0.39000000000000001, 0.56000000000000005, 0.53000000000000003], [0.5, 0.48999999999999999, 0.5, 0.55000000000000004, 0.51000000000000001, 0.55000000000000004, 0.62, 0.45000000000000001, 0.40999999999999998], [0.48999999999999999, 0.47999999999999998, 0.45000000000000001, 0.38, 0.53000000000000003, 0.55000000000000004, 0.47999999999999998, 0.52000000000000002, 0.56000000000000005], [0.48999999999999999, 0.48999999999999999, 0.38, 0.46999999999999997, 0.46000000000000002, 0.47999999999999998, 0.55000000000000004, 0.40999999999999998, 0.52000000000000002], [0.35999999999999999, 0.45000000000000001, 0.45000000000000001, 0.42999999999999999, 0.41999999999999998, 0.35999999999999999, 0.37, 0.34999999999999998, 0.48999999999999999], [0.56000000000000005, 0.60999999999999999, 0.57999999999999996, 0.64000000000000001, 0.64000000000000001, 0.55000000000000004, 0.56000000000000005, 0.58999999999999997, 0.47999999999999998], [0.45000000000000001, 0.64000000000000001, 0.45000000000000001, 0.5, 0.58999999999999997, 0.42999999999999999, 0.5, 0.55000000000000004, 0.46000000000000002], [0.72999999999999998, 0.63, 0.85999999999999999, 0.68000000000000005, 0.72999999999999998, 0.77000000000000002, 0.75, 0.69999999999999996, 0.67000000000000004], [0.70999999999999996, 0.72999999999999998, 0.81000000000000005, 0.75, 0.72999999999999998, 0.78000000000000003, 0.56999999999999995, 0.69999999999999996, 0.63], [0.39000000000000001, 0.26000000000000001, 0, 0, 0, 0, 0, 0, 0], [0.57999999999999996, 0.54000000000000004, 0, 0, 0, 0, 0, 0, 0], [0.58999999999999997, 0.55000000000000004, 0, 0, 0, 0, 0, 0, 0], [0.58999999999999997, 0.51000000000000001, 0, 0, 0, 0, 0, 0, 0], [0.54000000000000004, 0.60999999999999999, 0, 0, 0, 0, 0, 0, 0], [0.46000000000000002, 0.33000000000000002, 0, 0, 0, 0, 0, 0, 0], [0.62, 0.56999999999999995, 0, 0, 0, 0, 0, 0, 0], [0.41999999999999998, 0.56999999999999995, 0, 0, 0, 0, 0, 0, 0], [0.44, 0.55000000000000004, 0, 0, 0, 0, 0, 0, 0], [0.34000000000000002, 0.53000000000000003, 0, 0, 0, 0, 0, 0, 0], [0.42999999999999999, 0.33000000000000002, 0.31, 0.35999999999999999, 0.37, 0.42999999999999999, 0.34000000000000002, 0.40999999999999998, 0.42999999999999999], [0.40000000000000002, 0.34999999999999998, 0.40000000000000002, 0.34000000000000002, 0.39000000000000001, 0.38, 0.39000000000000001, 0.38, 0.46999999999999997], [0.38, 0.25, 0.34000000000000002, 0.26000000000000001, 0.38, 0.34000000000000002, 0.38, 0.33000000000000002, 0.42999999999999999], [0.46000000000000002, 0.39000000000000001, 0.35999999999999999, 0.32000000000000001, 0.28000000000000003, 0.35999999999999999, 0.40000000000000002, 0.28999999999999998, 0.44], [0.45000000000000001, 0.39000000000000001, 0.46000000000000002, 0.41999999999999998, 0.40000000000000002, 0.40999999999999998, 0.42999999999999999, 0.40999999999999998, 0.56999999999999995], [0.48999999999999999, 0.42999999999999999, 0.44, 0.45000000000000001, 0.5, 0.41999999999999998, 0.39000000000000001, 0.47999999999999998, 0.40000000000000002], [0.26000000000000001, 0.45000000000000001, 0.41999999999999998, 0.54000000000000004, 0.46000000000000002, 0.35999999999999999, 0.33000000000000002, 0.44, 0.46999999999999997], [0.23000000000000001, 0.44, 0.22, 0.41999999999999998, 0.41999999999999998, 0.29999999999999999, 0.23000000000000001, 0.35999999999999999, 0.37], [0.60999999999999999, 0.67000000000000004, 0.64000000000000001, 0.62, 0.63, 0.58999999999999997, 0.68999999999999995, 0.55000000000000004, 0.53000000000000003], [0.56000000000000005, 0.63, 0.63, 0.65000000000000002, 0.59999999999999998, 0.59999999999999998, 0.55000000000000004, 0.65000000000000002, 0.56999999999999995], [0.64000000000000001, 0.56000000000000005, 0.58999999999999997, 0.52000000000000002, 0.54000000000000004, 0.62, 0.65000000000000002, 0.51000000000000001, 0.51000000000000001], [0.67000000000000004, 0.52000000000000002, 0.57999999999999996, 0.55000000000000004, 0.55000000000000004, 0.59999999999999998, 0.57999999999999996, 0.65000000000000002, 0.52000000000000002], [0.56999999999999995, 0.67000000000000004, 0.56999999999999995, 0.65000000000000002, 0.57999999999999996, 0.57999999999999996, 0.65000000000000002, 0.54000000000000004, 0.56999999999999995], [0.45000000000000001, 0.55000000000000004, 0.52000000000000002, 0.65000000000000002, 0.56000000000000005, 0.53000000000000003, 0.46000000000000002, 0.63, 0.46000000000000002], [0.79000000000000004, 0.62, 0.82999999999999996, 0.53000000000000003, 0.66000000000000003, 0.83999999999999997, 0.81999999999999995, 0.71999999999999997, 0.68999999999999995], [0.68000000000000005, 0.77000000000000002, 0.78000000000000003, 0.68999999999999995, 0.72999999999999998, 0.71999999999999997, 0.77000000000000002, 0.68999999999999995, 0.64000000000000001]]
class_score = [[80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0], [81.519999999999996, 85.849999999999994, 83.450000000000003, 85.069999999999993, 82.680000000000007, 83.870000000000005, 0, 82.909999999999997, 89.730000000000004], [82.469999999999999, 84.269999999999996, 82.709999999999994, 83.599999999999994, 85.290000000000006, 84.530000000000001, 82.599999999999994, 82.430000000000007, 83.209999999999994], [79.390000000000001, 80.640000000000001, 80.700000000000003, 77.680000000000007, 80.370000000000005, 80.010000000000005, 82.510000000000005, 78.489999999999995, 78.969999999999999], [80.299999999999997, 80.659999999999997, 80.079999999999998, 78.909999999999997, 79.790000000000006, 78.739999999999995, 74.969999999999999, 80.650000000000006, 82.469999999999999], [80.459999999999994, 80.269999999999996, 81.790000000000006, 83.109999999999999, 79.579999999999998, 78.849999999999994, 80.400000000000006, 79.590000000000003, 78.299999999999997], [80.659999999999997, 80.760000000000005, 83.459999999999994, 81.079999999999998, 80.730000000000004, 80.659999999999997, 79.150000000000006, 82.519999999999996, 79.439999999999998], [84.269999999999996, 81.379999999999995, 81.409999999999997, 82.189999999999998, 82.090000000000003, 83.870000000000005, 84.069999999999993, 84.260000000000005, 80.430000000000007], [78.739999999999995, 76.859999999999999, 78.340000000000003, 74.780000000000001, 75.780000000000001, 78.829999999999998, 78.799999999999997, 77.760000000000005, 80.560000000000002], [82.069999999999993, 76.480000000000004, 82.109999999999999, 78.689999999999998, 78.340000000000003, 82.159999999999997, 79.829999999999998, 79.090000000000003, 81.370000000000005], [72.930000000000007, 76.989999999999995, 67.859999999999999, 75.379999999999995, 73.599999999999994, 72.590000000000003, 75.230000000000004, 74.890000000000001, 75.269999999999996], [72.650000000000006, 72.359999999999999, 70.640000000000001, 73.189999999999998, 73.010000000000005, 70.849999999999994, 77.879999999999995, 73.969999999999999, 76.409999999999997], [82.340000000000003, 86.349999999999994, 0, 0, 0, 0, 0, 0, 0], [77.969999999999999, 78.680000000000007, 0, 0, 0, 0, 0, 0, 0], [77.310000000000002, 79.239999999999995, 0, 0, 0, 0, 0, 0, 0], [77.739999999999995, 80.290000000000006, 0, 0, 0, 0, 0, 0, 0], [78.409999999999997, 76.810000000000002, 0, 0, 0, 0, 0, 0, 0], [81.420000000000002, 84.019999999999996, 0, 0, 0, 0, 0, 0, 0], [77.049999999999997, 77.939999999999998, 0, 0, 0, 0, 0, 0, 0], [82.319999999999993, 78.859999999999999, 0, 0, 0, 0, 0, 0, 0], [81.780000000000001, 78.609999999999999, 0, 0, 0, 0, 0, 0, 0], [84.310000000000002, 79.170000000000002, 0, 0, 0, 0, 0, 0, 0], [82.049999999999997, 84.659999999999997, 84.680000000000007, 83.650000000000006, 83.549999999999997, 81.439999999999998, 84.140000000000001, 82.640000000000001, 82.299999999999997], [83.099999999999994, 84.180000000000007, 83.379999999999995, 84.420000000000002, 83.180000000000007, 83.359999999999999, 83.109999999999999, 83.609999999999999, 81.060000000000002], [83.510000000000005, 86.280000000000001, 84.489999999999995, 85.650000000000006, 83.299999999999997, 84.519999999999996, 83.370000000000005, 84.510000000000005, 82.040000000000006], [81.200000000000003, 83.329999999999998, 83.760000000000005, 84.650000000000006, 86.120000000000005, 83.700000000000003, 82.450000000000003, 85.420000000000002, 81.840000000000003], [81.390000000000001, 82.719999999999999, 81.219999999999999, 82.069999999999993, 82.599999999999994, 82.430000000000007, 81.260000000000005, 82.459999999999994, 78.200000000000003], [80.719999999999999, 82.0, 82.129999999999995, 81.969999999999999, 79.799999999999997, 82.489999999999995, 83.049999999999997, 81.109999999999999, 82.700000000000003], [86.0, 81.599999999999994, 82.260000000000005, 79.099999999999994, 80.780000000000001, 83.700000000000003, 84.519999999999996, 81.560000000000002, 80.609999999999999], [87.420000000000002, 81.650000000000006, 86.959999999999994, 82.519999999999996, 82.719999999999999, 85.480000000000004, 87.859999999999999, 83.920000000000002, 83.370000000000005], [77.040000000000006, 75.760000000000005, 76.620000000000005, 76.950000000000003, 76.920000000000002, 77.849999999999994, 74.739999999999995, 78.469999999999999, 79.159999999999997], [78.310000000000002, 76.340000000000003, 76.209999999999994, 75.799999999999997, 77.069999999999993, 77.719999999999999, 78.75, 75.900000000000006, 77.870000000000005], [76.459999999999994, 78.75, 78.269999999999996, 79.879999999999995, 78.790000000000006, 76.480000000000004, 76.400000000000006, 79.870000000000005, 80.140000000000001], [75.640000000000001, 79.379999999999995, 77.909999999999997, 78.920000000000002, 79.200000000000003, 77.540000000000006, 78.530000000000001, 75.909999999999997, 79.659999999999997], [78.409999999999997, 75.579999999999998, 78.540000000000006, 76.599999999999994, 78.269999999999996, 77.819999999999993, 76.090000000000003, 79.319999999999993, 78.430000000000007], [81.439999999999998, 77.840000000000003, 79.879999999999995, 75.010000000000005, 78.120000000000005, 79.209999999999994, 81.140000000000001, 76.379999999999995, 80.989999999999995], [70.849999999999994, 77.409999999999997, 69.689999999999998, 79.079999999999998, 75.680000000000007, 70.079999999999998, 70.209999999999994, 73.109999999999999, 74.129999999999995], [74.530000000000001, 72.909999999999997, 71.459999999999994, 75.030000000000001, 72.859999999999999, 74.670000000000002, 72.599999999999994, 75.049999999999997, 75.879999999999995]]


def statistic_sub_teacher():
    teacherInfo = pd.read_csv(filepath_teacherInfo)
    score_merge_studentid = pd.read_csv(filepath_score_merge_studentid)
    sub_name = ['语文', '数学', '英语', '物理', '化学', '政治', '历史', '生物', '地理']
    sub_teachers_id_all = []
    sub_teachers_name_all = []
    sub_teachers_score_all = []
    sub_teachers_score_all_average = []
    for i in range(len(sub_name)):
        sub_data = teacherInfo[teacherInfo['sub_Name'].str.contains(sub_name[i])]
        # 教师名
        sub_teachers_name = []
        sub_teachers_id = []
        sub_teachers_data = sub_data.groupby(['bas_id']).count().reset_index()
        for j in range(sub_teachers_data.shape[0]):
            sub_teachers_id.append(sub_teachers_data['bas_id'].iloc[j])
        for j in range(len(sub_teachers_id)):
            for k in range(sub_data.shape[0]):
                if sub_teachers_id[j] == sub_data['bas_id'].iloc[k]:
                    sub_teachers_name.append(sub_data['bas_Name'].iloc[k])
                    break
        # 找到该老师所带的班级
        sub_teacher_scores = []
        sub_teacher_scores_average = []
        for j in range(len(sub_teachers_id)):
            sub_teacher_scores_piece = []
            teacher_class = []
            sub_teachers_data_drop = sub_data.drop(sub_data[sub_data['bas_id'] != sub_teachers_id[j]].index)
            sub_teachers_data_groupby = sub_teachers_data_drop.groupby(['cla_id']).count().reset_index()
            for k in range(sub_teachers_data_groupby.shape[0]):
                teacher_class.append(sub_teachers_data_groupby['cla_id'].iloc[k])
            # print(teacher_class)
            teacher_class_score = 0
            count = 0
            for k in range(len(teacher_class)):
                for m in range(len(class_id)):
                    if teacher_class[k] == class_id[m]:
                        teacher_class_score += class_score[m][i]
                        count += 1
                        break
            if count != 0:
                teacher_score = round((teacher_class_score / count), 2)
            else:
                teacher_score = 80
            # print(teacher_score)
            # sub_teacher_scores_piece.append(sub_teachers_name[j])
            # sub_teacher_scores_piece.append(teacher_score)
            # sub_teacher_scores_piece.append(sub_teachers_id[j])
            # sub_teacher_scores.append(sub_teacher_scores_piece)

            sub_teacher_scores.append(teacher_score)
            sub_teacher_scores_average.append(80)

        sub_teachers_score_all.append(sub_teacher_scores)
        sub_teachers_name_all.append(sub_teachers_name)
        sub_teachers_score_all_average.append(sub_teacher_scores_average)
        # print(sub_teacher_scores)
    print(sub_teachers_score_all)
    print(sub_teachers_name_all)
    print(sub_teachers_score_all_average)

statistic_sub_teacher()

def caculate_class_average_score():
    sub_name = ['语文', '数学', '英语', '物理', '化学', '政治', '历史', '生物', '地理']
    score_merge_studentid = pd.read_csv(filepath_score_merge_studentid)
    score_merge_studentid = score_merge_studentid.dropna(subset=['mes_T_Score'])
    score_merge_studentid_groupby = score_merge_studentid.groupby(['cla_id']).count().reset_index()
    class_id = []
    for i in range(score_merge_studentid_groupby.shape[0]):
        class_id.append(score_merge_studentid_groupby['cla_id'].iloc[i])
    class_score_array = []
    for i in range(len(class_id)):
        class_score = score_merge_studentid.drop(score_merge_studentid[score_merge_studentid['cla_id'] != class_id[i]].index)
        class_sub_score_array = []
        for j in range(len(sub_name)):
            class_sub_score = class_score.drop(class_score[class_score['mes_sub_name'] != sub_name[j]].index)
            if class_sub_score.shape[0] == 0:
                class_sub_score_array.append(0)
            else:
                score_all = 0
                for k in range(class_sub_score.shape[0]):
                    score_all += class_sub_score['mes_T_Score'].iloc[k]
                average_score = round((score_all / class_sub_score.shape[0]), 2)
                class_sub_score_array.append(average_score)
        class_score_array.append(class_sub_score_array)
    print(class_id)
    print(len(class_id))
    print(class_score_array)
    print(len(class_score_array))

# caculate_class_average_score()

def caculate_sub_average():
    score_data = pd.read_csv(filepath_score_merge_studentid)
    score_data = score_data.dropna(subset=['mes_T_Score'])
    sub_name = ['语文', '数学', '英语', '物理', '化学', '政治', '历史', '生物', '地理']
    sub_average_score = []
    for i in range(len(sub_name)):
        sub_score_data = score_data.drop(score_data[score_data['mes_sub_name'] != sub_name[i]].index)
        sub_score_all = 0
        # print(sub_score_data.shape[0])
        for j in range(sub_score_data.shape[0]):
            sub_score_all += sub_score_data['mes_T_Score'].iloc[j]
        sub_score_average = round((sub_score_all / sub_score_data.shape[0]) ,2)
        sub_average_score.append(sub_score_average)
    print(sub_average_score)

# caculate_sub_average()

# 平均分都是80