What's the simplest way to extend a numpy array in 2 dimensions?

前端 未结 7 1017
后悔当初
后悔当初 2020-12-02 13:00

I have a 2d array that looks like this:

XX
xx

What\'s the most efficient way to add an extra row and column:

xxy
xxy
yyy
         


        
7条回答
  •  没有蜡笔的小新
    2020-12-02 13:38

    maybe you need this.

    >>> x = np.array([11,22])
    >>> y = np.array([18,7,6])
    >>> z = np.array([1,3,5])
    >>> np.concatenate((x,y,z))
    array([11, 22, 18,  7,  6,  1,  3,  5])
    

提交回复
热议问题