The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() using panda python enter preformatted text hereHere I have data to import from a CSV file.I wrote an equation inside the class and to solve the equation data will import from the CSV file. 
When I run my code I got an error like "tuple indices must be integers or slices, not str" using panda python.
Can anyone help me to solve this problem?
I upload my code and CSV file here.

def ph_convert(time,we,h,a,w):
while time &lt;= 30:
    level = 1.1
    level = float(level)
    if w == 1:
        ph= ((((6*we)+(1*h))/level -(4*a)))/time
    else:
        ph= ((6+((1*we)+(3*h))/level -(6 *a)))/time  
    break
while time &lt;=60:
    level = 1.25
    level = float(level)
    if w == 1:
        ph= ((((6*we)+(1*h))/level -(4*a)))/time
    else:
        ph= ((6+((1*we)+(3*h))/level -(6 *a)))/time  
    break
print(ph)

data = pd.read_csv('data1.csv')
data['time'] = data['time'].apply(time_convert)
we = data['we'].astype(float)
h = data['h'].astype(float)
a = data['a'].astype(float)
w = data['w'].astype(float)
time = data['time'].astype(float)
print(ph_convert(time,we,h,a,w))


Subset of my CSV file:

we  h   a   w   time
48.1    150 53  1   6:15:00
48.1    150 53  1   9:00:00
48.1    150 53  1   9:25:00
48.1    150 53  1   9:30:00
48.1    150 53  1   11:00:00


error:



[![enter image description here][2]][2]
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:
        ...