(Feb-24-2017, 04:51 PM)bertibott Wrote: This gives me an error that I do not understand in the slightest:
Error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Stackoverflow gives me many posts of people who have been getting this message while doing completely different things...
Generally you are going to want to use
np.max
and
np.min
in numpy contexts. The builtin will work in one dimensional cases but not multi dimensional.
>>> a = np.array([4,5,6])
>>> max(a)
6
>>> a = np.array([[4,5,6],[5,6,7]])
>>> max(a)
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
>>> np.max(a)
7
>>>