📜  python 从 numpy 数组中选择随机子集 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:03.991000             🧑  作者: Mango

代码示例1
fruits = ['apple', 'banana', 'orange', 'grape']
subset_size = int(0.7 * len(fruits))
np.random.choice(fruits, subset_size, replace=False)
# array(['grape', 'banana'], dtype='