Python Numpy Пример функции работы с осью

# welcome to softhunt.net
# Python Program illustrating
# numpy.append()

import numpy as np

#Working on 1D
arr1 = np.arange(8).reshape(2, 4)
print("2D arr1 : \n", arr1)
print("Shape : ", arr1.shape)


arr2 = np.arange(8, 16).reshape(2, 4)
print("\n2D arr2 : \n", arr2)
print("Shape : ", arr2.shape)


# appending the arrays
arr3 = np.append(arr1, arr2)
print("\nAppended arr3 by flattened : ", arr3)

# appending the arrays with axis = 0
arr3 = np.append(arr1, arr2, axis = 0)
print("\nAppended arr3 with axis 0 : \n", arr3)

# appending the arrays with axis = 1
arr3 = np.append(arr1, arr2, axis = 1)
print("\nAppended arr3 with axis 1 : \n", arr3)
Outrageous Ostrich