I was comparing each value from a matrix (created using NumPy) with the value of a variable. But I keep getting this error:
File "main.py", line 63, in findClusters if(val<=nearest): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I tried printing out the value and its not an array, but a float value. When I gave all(val), the error is "float is not iterable" Whats wrong with my code?
for i in range(0,count):
nearest = 99999.99
for ctr in center:
val = mtrx.item((ctr,i))
if(val<=nearest):
nearest = mtrx[ctr][i]
centerassign = ctr
if val.all() <= nearest:nearest = mtrx[ctr][i]and not inval = mtrx.item((ctr,i))?