我想检查数据帧的最后一个值是否等于某个值。 像
Name class year
abc 17 2018
cdf 23 2016
ded 39 2019
if df['year'].loc[:-1] == 2019:
print ('yes')
The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().