数据校验,轴的概念

import pandas as pd


def score_valication(row):
    try:
        assert 0 <= row.Score <= 100
    except:
        print(f'#{row.ID}\tstudent {row.Name} has an invalid score {row.Score}')


students = pd.read_excel('C:/Temp/Students.xlsx')
# print(students)
students.apply(score_valication, axis=1)

 

posted @ 2019-06-19 20:26  Inserence  阅读(165)  评论(0编辑  收藏  举报