9951 explained code solutions for 126 technologies


python-numpyInsert multiple values into Numpy array


import numpy as np
a = np.array([5, 6, 6])

np.insert(a, 3, [1, 2])ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

np.insert

insert specified value at specified position

3

position to insert new value at

[1, 2]

values to insert (all values from array will be inserted into given array)