2011-09-30 49 views

回答

4
import numpy as np 
a = np.array([[1,2,3,4],[1,2,3,4]]) 

首先可能性:

a.repeat(2, axis=1) 

或第二:

np.kron(a, [1,1]) 

兩個返回:

array([[1, 1, 2, 2, 3, 3, 4, 4], 
     [1, 1, 2, 2, 3, 3, 4, 4]])