I have two arrays:
import numpy as np
a = np.array([[1,2,3], [4,5,6]])
b = np.array([5, 6])
when I try to append b to a as a's last column using the below code
np.hstack([a, b])
it thows an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<__array_function__ internals>", line 6, in hstack
File "C:\Users\utkal\anaconda3\envs\AIML\lib\site-packages\numpy\core\shape_base.py", line 345, in hstack
return _nx.concatenate(arrs, 1)
File "<__array_function__ internals>", line 6, in concatenate
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 2 dimension(s) and the array at index 1 has 1 dimension(s)
I want the final array as:
1 2 3 5
4 5 6 6
bisn't a column.