I have two arrays that I want to merge to a new one but I need to insert the indices in specific places
array1 = np.arange(95,320,4) array2 = np.arange(0,360,2)
array1 = 95, but I want this value to be in a new array between
array2 which equals 94 and
array2 that equals 96, and so on with the rest of the values inside array1.
Is this possible?
I think that you’re looking for numpy.insert
array1 = np.arange(95,320,4) array2 = np.arange(0,360,2) for i, value in enumerate(array1): index = i+48+i*2 array2 = np.insert(array2, index, array1[i])
Answered By – remarcoble