2
a1=array([[0, 1, 2, 3, 4],
   [5, 6, 7, 8, 9]])
a2=array([[0, 1],
   [2, 3]])
a3 = array([[0, 1, 2, 3, 4, 0, 1],
   [5, 6, 7, 8, 9, 2, 3]])

I have two arrays a1,a2,I want to merge them together.the result is a3

CCIEGZM
  • 105
  • 1
  • 7
  • See [Numpy: Joining structured arrays?](http://stackoverflow.com/q/5355744/1761793) – Ajoy May 20 '15 at 02:21
  • Also, [Concatenate two arrays vertically](http://stackoverflow.com/q/21887754/1761793) has your answer in the question itself. – Ajoy May 20 '15 at 02:28

2 Answers2

1

Using numpy np.concatenate() this way should work

 a3 = np.concatenate((a1,a2),axis = 1)
farhawa
  • 10,120
  • 16
  • 49
  • 91
1

np.c_[a1, a2]

also a np.r_ for row-wise merging.

seven7e
  • 798
  • 1
  • 8
  • 19