Python Numpy Insert Fonction Exemple de travail avec des scalaires

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

import numpy as np

# Working on 2D array
arr = np.arange(12).reshape(3, 4)
print("2D arr : \n", arr)
print("Shape : ", arr.shape)

# Working with Scalars
a = np.insert(arr, [1], [[6],[9],], axis = 0)
print("\nArray after insertion : \n", a)
print("Shape : ", a.shape)

# Working with Scalars
a = np.insert(arr, [1], [[8],[7],[9]], axis = 1)
print("\nArray after insertion : \n", a)
print("Shape : ", a.shape)
Outrageous Ostrich