import  pandas
def  price_3_to_7(a):
    return 3<=a<=7
def  time_3_to_8(b):
    return 3<=b<=8

excel=pandas.read_excel('填充数据.xlsx',header=3,index_col='id')
excel.fillna(0,inplace=True)

#以下两个语句的功能都一样
#excel=excel.loc[excel['price'].apply(price_3_to_7)].loc[excel['time'].apply(time_3_to_8)]    #进行两次筛选
excel=excel.loc[excel.price.apply(price_3_to_7)].loc[excel.time.apply(time_3_to_8)]        #进行两次筛选


print(excel)

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。