如果我在列表中有一组项目.我想根据另一个权重列表从该列表中进行选择.
例如我的收藏是['one', 'two', 'three']和权重[0.2, 0.3, 0.5],我希望这个方法在所有抽奖的大约一半中给我'三'.
['one', 'two', 'three']
[0.2, 0.3, 0.5]
最简单的方法是什么?
python numpy
numpy ×1
python ×1