The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() using panda python
while time &lt;= 30:


You are trying to evaluate the vector time, but in python, boolean evaluations with that expression can only be done over scalars. The thing is, as time has multiple values, the Python interpreter can't figure out if the condition must hold over all of them, just one, etc.

If you want to evaluate if any of the values of time, or all the values in time you can use methods like time.any() or time.all()

You can always walk through all the items in time and perform the evaluation on them:

for t in time:
    if t &lt;= 30:
        ...