2017-08-01 95 views

回答

0
import numpy as np 

a = np.array([1, 1, 1, 0]) 

#how often to repeat the array along first dimension? 
b = 20 

#repeat b times along first dimension, one time along second 
x = np.tile(a, (b,1)) 

print(x) 

#just some consecutive numbers 
y = np.arange(20) 
print(y) 

#overwrite fourth column of array 
x[:, 3] = y 

print(x)