vstack & hstack & concatenate

來源:互聯網
上載者:User

標籤:

 1 In[86]: a,b 2 Out[86]: (array([1, 2, 3]), array([4, 5, 6])) 3 In[87]: np.concatenate((a,b),axis=0) 4 Out[87]: array([1, 2, 3, 4, 5, 6]) 5 In[88]: np.concatenate((a,b),axis=1) 6 Out[88]: array([1, 2, 3, 4, 5, 6]) 7 In[89]: np.vstack((a,b)) 8 Out[89]:  9 array([[1, 2, 3],10        [4, 5, 6]])11 In[90]: np.hstack((a,b))12 Out[90]: array([1, 2, 3, 4, 5, 6])13 In[93]: a114 Out[93]: 15 array([[1, 2, 3],16        [4, 5, 6]])17 In[94]: a218 Out[94]: 19 array([[ 7,  8,  9],20        [10, 11, 12]])21 In[95]: np.concatenate((a1,a2),axis=0)22 Out[95]: 23 array([[ 1,  2,  3],24        [ 4,  5,  6],25        [ 7,  8,  9],26        [10, 11, 12]])27 In[96]: np.concatenate((a1,a2),axis=1)28 Out[96]: 29 array([[ 1,  2,  3,  7,  8,  9],30        [ 4,  5,  6, 10, 11, 12]])31 In[97]: np.vstack((a1,a2))32 Out[97]: 33 array([[ 1,  2,  3],34        [ 4,  5,  6],35        [ 7,  8,  9],36        [10, 11, 12]])37 In[98]: np.hstack((a1,a2))38 Out[98]: 39 array([[ 1,  2,  3,  7,  8,  9],40        [ 4,  5,  6, 10, 11, 12]])

 

vstack & hstack & concatenate

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.