Numpy: Concatenating multidimensional and unidimensional arrays
问题 I have a 2x2 numpy array : x = array(([[1,2],[4,5]])) which I must merge (or stack, if you wish) with a one-dimensional array : y = array(([3,6])) by adding it to the end of the rows, thus making a 2x3 numpy array that would output like so : array([[1, 2, 3], [4, 5, 6]]) now the proposed method for this in the numpy guides is : hstack((x,y)) however this doesn't work, returning the following error : ValueError: arrays must have same number of dimensions The only workaround possible seems to