Reputation:
In the documentation, this function is said to
Stack arrays in sequence horizontally (column wise).
I don't really understand what "column wise" means exactly. Can someone explain it with the example code as provided by the documentation?
>>> a = np.array([[1],[2],[3]])
>>> b = np.array([[2],[3],[4]])
>>> np.hstack((a,b))
array([[1, 2],
[2, 3],
[3, 4]])
Upvotes: 0
Views: 407
Reputation: 44838
Array A looks like this:
1
2
3
Array B looks like this:
2
3
4
Put array B alongside array A:
A B
1 2
2 3
3 4
This is your new array!
Upvotes: 2