Suppose numpy vector a and matrix b as below:
import numpy as np
a = np.array([1,2])
b = np.array([[3,4],[5,6]])
I want to concatenate vector a into each row of matrix b. The expected output is as below:
output=np.array([[1,2,3,4],[1,2,5,6]])
I have a working code as below:
output=np.array([np.concatenate((a,row)) for row in b] )
Is there any faster numpy function to perform such a task? Any suggestion is appreciated!
