[Numpy] Probably the shortest way to alternately synthesize two one-dimensional arrays

import numpy as np

a = [0, 1, 2, 3, 4] #One-dimensional array 1
b = [5, 6, 7, 8, 9] #One-dimensional array 2

c = np.c_[a, b].flat[:] #Synthetic

print(c)

out


[0 5 1 6 2 7 3 8 4 9] #The output is ndarray

Recommended Posts

[Numpy] Probably the shortest way to alternately synthesize two one-dimensional arrays
The easiest way to synthesize speech with python
Probably the easiest way to create a pdf with Python3
Cython to try in the shortest
The fastest way to try EfficientNet
The easiest way to make Flask
The easiest way to try PyQtGraph