我有一个collections.deque()元组,我想从中抽取随机样本.在Python 2.7中,我可以使用batch = random.sample(my_deque, batch_size).
batch = random.sample(my_deque, batch_size)
但是在Python 3.4中提出了这个问题 TypeError: Population must be a sequence or set. For dicts, use list(d).
TypeError: Population must be a sequence or set. For dicts, use list(d).
什么是最好的解决方法,或推荐的方法从Python 3中的双端队列中有效地采样?
python random python-2.7 python-3.x
python ×1
python-2.7 ×1
python-3.x ×1
random ×1