Compare Numpy Array

Aug 28, 2020
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
import numpy as npa = np.array([1, 2])b = np.array([1, 2])print(np.array_equal(a, b))# if a and b has different length, AttributeError: 'bool' object has no attribute 'all'# print((a == b).all())

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.