a = np.array([
[1, 2, 4],
[11, 22, 34],
[2, 5, 7]
])
(3, 3)
b = np.array([
[19, 18, 16],
[9, -2, -14],
[18, 15, 13]
])
(3, 3)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-20-9fadeb0cc951> in <module>()
----> 1 c = np.concatenate(a, b)
TypeError: only integer scalar arrays can be converted to a scalar index
# The above line is throwing an issue because it is passed as an argument instead of sequence of argument. The arrays you want to concatenate need to passed in as a sequence, not as separate arguments.
c = np.concatenate((a, b))
array([[ 1, 2, 4],
[ 11, 22, 34],
[ 2, 5, 7],
[ 19, 18, 16],
[ 9, -2, -14],
[ 18, 15, 13]])
(6, 3)
# Concatenate column level
d = np.concatenate((a, b), axis=1)
array([[ 1, 2, 4, 19, 18, 16],
[ 11, 22, 34, 9, -2, -14],
[ 2, 5, 7, 18, 15, 13]])
(3, 6)