I have this seemingly simple bit of code in which I calculate the level of fuel for fuel cell operation. If I execute the code line by line I get valid results but when I try to run the whole conditional statement I get the "ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()." I've run out of ideas for solve this problem, any help is very welcomed.
fuel=pd.DataFrame()
if df3['DCS1'].tail(1)==1:
fuel['fuel left']=56-(df3['Methanol consumed'].tail(1))
else:
fuel['fuel left']=28-(df3['Methanol consumed'].tail(1))```