Reputation: 1995
I am trying to combine two 1D arrays and stack them in columns,
a = [1 2 3]
b = [4 5 6]
# such that, they produce
a b
c = [1 4
2 5
3 6]
# the python syntax for such operation is
np.stack_column((a,b))
Please can someone suggest the julia syntax for this operation?
Upvotes: 4
Views: 290
Reputation: 1995
On of my friend suggested two ways of executing this,
1. transpose(vcat(a,b))
hcat(a', b')
2. reshape(hcat(a,b), (3,2))
Array{Int64,2}:
1 4
2 5
3 6
3×2 Array{Int64,2}: 1 4 2 5 3 6
Upvotes: 3