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