Answers for "numpy filter based on sum of array"

1

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')
Posted by: Guest on March-03-2020

Code answers related to "numpy filter based on sum of array"

Python Answers by Framework

Browse Popular Code Answers by Language