亲测第二种好用
- in 语句 不包含使用not in
food = df['日期'].values.tolist()
if '休息' in food:
print(food)
if df['共计小时']<4:
df['餐补']=0
print(df['餐补'])
elif 4<=df['共计小时']<10:
df['餐补']=25
else:
df['餐补']=50
- contains
mask=df['日期'].str.contains(r'休息',na=True)