Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python select random subset from numpy array

fruits = ['apple', 'banana', 'orange', 'grape']
subset_size = int(0.7 * len(fruits))
np.random.choice(fruits, subset_size, replace=False)
# array(['grape', 'banana'], dtype='<U6')
Source by docs.scipy.org #
 
PREVIOUS NEXT
Tagged: #python #select #random #subset #numpy #array
ADD COMMENT
Topic
Name
6+9 =