Students11.xlsx

    1. import pandas as pd
    2. # def score_validation(row):
    3. # try:
    4. # assert 0 <= row.Score <= 100
    5. # except:
    6. # print(f'#{row.ID}\tstudents{row.Name} has an invalidation score {row.Score}')
    7. def score_validation(row):
    8. if not 0 <= row.Score <= 100:
    9. print(f'#{row.ID}\tstudents{row.Name} has an invalidation score {row.Score}')
    10. students = pd.read_excel('tmp1\Students11.xlsx')
    11. students.apply(score_validation, axis=1) # 1表从左到右的轴 0表示从上到下的轴
    12. # 1表示横轴,方向从左到右;0表示纵轴,方向从上到下。
    13. """
    14. #1 studentsStudent_001 has an invalidation score -40
    15. #2 studentsStudent_002 has an invalidation score -30
    16. #3 studentsStudent_003 has an invalidation score -20
    17. #4 studentsStudent_004 has an invalidation score -10
    18. #16 studentsStudent_016 has an invalidation score 110
    19. #17 studentsStudent_017 has an invalidation score 120
    20. #18 studentsStudent_018 has an invalidation score 130
    21. #19 studentsStudent_019 has an invalidation score 140
    22. #20 studentsStudent_020 has an invalidation score 150
    23. """