I have a matrix and I want to add a vector into the fourth row of the matrix. I am using vstack but I am having trouble figuring out how to input it as the fourth row. If I input the new vector as either the first or second argument, it will add the vector as the first or last row of them matrix. Here is my example:
A = np.reshape(range(1,21),(4,5)
print (A)
B = np.vstack([(10,3,5,2,6),A])
print(B)
With this code, B will have the new vector as the first row of the matrix. I need it to be the fourth row so that when I print B, the last row of the matrix is [16,17,18,19,20] and B becomes a 5x5 matrix.
[1 2 3 4 5]
[6 7 8 9 10]
[11 12 13 14 15]
[10 3 5 2 6]
[16 17 18 19 20]
The matrix above is my desired output. What do I need to include?