``````

In [1]:

import numpy as np

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

In [2]:

a1 = np.ones((2, 3), int)
print(a1)

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

[[1 1 1]
[1 1 1]]

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

In [3]:

a2 = np.full((2, 3), 2)
print(a2)

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

[[2 2 2]
[2 2 2]]

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

In [4]:

print(np.concatenate([a1, a2]))

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

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

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

In [5]:

a3 = np.full((2, 3), 3)
print(a3)

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

[[3 3 3]
[3 3 3]]

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

In [6]:

print(np.concatenate([a1, a2, a3]))

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

[[1 1 1]
[1 1 1]
[2 2 2]
[2 2 2]
[3 3 3]
[3 3 3]]

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

In [7]:

print(np.concatenate([a1, a2], 0))

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

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

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

In [8]:

print(np.concatenate([a1, a2], 1))

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

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

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

In [9]:

# print(np.concatenate([a1, a2], 2))
# AxisError: axis 2 is out of bounds for array of dimension 2

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

In [10]:

a2_ = np.full((3, 3), 2)
print(a2_)

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

[[2 2 2]
[2 2 2]
[2 2 2]]

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

In [11]:

print(np.concatenate([a1, a2_], 0))

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

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

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

In [12]:

# print(np.concatenate([a1, a2_], 1))
# ValueError: all the input array dimensions except for the concatenation axis must match exactly

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

In [13]:

a1 = np.ones(3, int)
print(a1)

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

[1 1 1]

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

In [14]:

a2 = np.full(3, 2)
print(a2)

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

[2 2 2]

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

In [15]:

print(np.concatenate([a1, a2], 0))

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

[1 1 1 2 2 2]

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

In [16]:

# print(np.concatenate([a1, a2], 1))
# AxisError: axis 1 is out of bounds for array of dimension 1

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

In [17]:

a1 = np.ones((2, 3), int)
print(a1)

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

[[1 1 1]
[1 1 1]]

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

In [18]:

a2 = np.full(3, 2)
print(a2)

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

[2 2 2]

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

In [19]:

# print(np.concatenate([a1, a2], 0))
# ValueError: all the input arrays must have same number of dimensions

``````