>>> a = np.array([1, 2, 5, 7])
>>> b = np.array([1, 2, 5, 7])
# Method 1: use array_equal()
>>> np.array_equal(a, b)
True
# Method 2: use == operator and all()
>>> print((a == b).all())
True
# Method 3: use numpy.allcloses()
>>> np.allclose(a, b)
True
# Method 4: user numpy.array_equiv()
>>> np.array_equiv(a, b)
True
Related Posts
Aron
A data scientist working in a retail company, with experience in web design and marketing. Recently dives into cryptocurrency and quantitative investing.