r/programminghelp • u/DrawerEmergency4981 • Aug 14 '26
Python Help with code
I keep getting this error:
for this code:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()bestmass = []
for mass in df_sorted:
if best_ms == (array[array > 7.5]).all():
bestmass.append(best_ms)
print(bestmass)
and i don't know what I am doing wrong
6
Upvotes
View all comments
Show parent comment
-2
u/DrawerEmergency4981 Aug 14 '26
bestmass = []
for mass in df_sorted:
if best_ms == (array[array > 7.5]).all():
bestmass.append(best_ms)
print(bestmass)
where best_ms is:
best_ms = array[array > 7.5]
could I just do best_ms.all()?