``````

In [1]:

import numpy as np

``````
``````

In [2]:

a = np.arange(3)
print(a)

``````
``````

[0 1 2]

``````
``````

In [3]:

b = np.arange(3)
print(b)

``````
``````

[0 1 2]

``````
``````

In [4]:

c = np.arange(1, 4)
print(c)

``````
``````

[1 2 3]

``````
``````

In [5]:

print(np.all(a == b))

``````
``````

True

``````
``````

In [6]:

print(np.all(a == c))

``````
``````

False

``````
``````

In [7]:

print(np.array_equal(a, b))

``````
``````

True

``````
``````

In [8]:

print(np.array_equal(a, c))

``````
``````

False

``````
``````

In [9]:

print(np.array_equiv(a, b))

``````
``````

True

``````
``````

In [10]:

print(np.array_equiv(a, c))

``````
``````

False

``````
``````

In [11]:

b_f = np.arange(3, dtype=float)
print(b_f)

``````
``````

[0. 1. 2.]

``````
``````

In [12]:

print(np.array_equal(a, b_f))

``````
``````

True

``````
``````

In [13]:

print(np.array_equiv(a, b_f))

``````
``````

True

``````
``````

In [14]:

ones = np.ones(3)
print(ones)

``````
``````

[1. 1. 1.]

``````
``````

In [15]:

print(np.array_equal(ones, 1))

``````
``````

False

``````
``````

In [16]:

print(np.array_equiv(ones, 1))

``````
``````

True

``````
``````

In [17]:

a_2d = np.array([[0, 1, 2], [0, 1, 2], [0, 1, 2]])
print(a_2d)

``````
``````

[[0 1 2]
[0 1 2]
[0 1 2]]

``````
``````

In [18]:

print(np.array_equal(a_2d, b))

``````
``````

False

``````
``````

In [19]:

print(np.array_equiv(a_2d, b))

``````
``````

True

``````
``````

In [20]:

a_nan = np.array([np.nan, 1, 2])
print(a_nan)

``````
``````

[nan  1.  2.]

``````
``````

In [21]:

b_nan = np.array([np.nan, 1, 2])
print(b_nan)

``````
``````

[nan  1.  2.]

``````
``````

In [22]:

print(np.array_equal(a_nan, b_nan))

``````
``````

False

``````
``````

In [23]:

print(np.array_equiv(a_nan, b_nan))

``````
``````

False

``````
``````

In [24]:

print(np.all(a_nan == b_nan))

``````
``````

False

``````