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数据过滤和筛选
最新推荐文章于 2025-07-14 18:35:17 发布