I am having a problem splicing together two arrays. Let’s assume I have two arrays:
JavaScript
x
3
1
a = array([1,2,3])
2
b = array([4,5,6])
3
When I do vstack((a,b))
I get
JavaScript
1
2
1
[[1,2,3],[4,5,6]]
2
and if I do hstack((a,b))
I get:
JavaScript
1
2
1
[1,2,3,4,5,6]
2
But what I really want is:
JavaScript
1
2
1
[[1,4],[2,5],[3,6]]
2
How do I accomplish this without using for loops (it needs to be fast)?
Advertisement
Answer
column_stack
.