guopengfa
发布于 2020-05-08 / 564 阅读 / 0 评论 / 0 点赞

pandas多条件筛选

#方法1
import pandas as pd

if name == 'main':
data = pd.read_excel("D:\Python\数据分析\datasource\测试表.xlsx")
data = data[(data.学生>1)&(data.学生<5)]
print(data)

#方法2
import numpy

data = numpy.arange(0,10,0.01)
for i in data:
if i == 7.06:
print("YEs")

#方法3
data = data[data.学生.isin([1,2,3,4,])]


评论