python - How to create a numpy array of N numbers of the same value? -
this surely easy question:
how 1 create numpy array of n values, same value?
for instance, numpy.arange(10) creates 10 values of integers 0 9.
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) i create numpy array of 10 values of same integer,
array([3, 3, 3, 3, 3, 3, 3, 3, 3, 3])
import numpy np np.full(10, 3, dtype=np.int) out[2]: array([3, 3, 3, 3, 3, 3, 3, 3, 3, 3])
Comments
Post a Comment