import pandas as pd
def age_18_to_30(a):
return 18<=a<30
def level_a(s):
return 85 <= s <= 100
students = pd.read_excel("C:/Users/asus/Downloads/008/Students.xlsx",index_col="ID")
students = students.loc[students["Age"].apply(age_18_to_30)].loc[students.Score.apply[level_a]]
print(students)
pandas数据过滤和筛选
最新推荐文章于 2024-05-15 15:18:29 发布