说我得到以下输出,其中包含来自多个列表的多个计数器对象:
pModel
输出:
for b in data:
m = np.sum(b.values())
individuals = [i for i in b.values() if i != 0]
counter = collections.Counter(individuals)
现在我要尝试的是将计数器对象中每个键的Counter({1: 10, 2: 2})
Counter({1: 19, 4: 1, 5: 1})
Counter({1: 14, 2: 4, 3: 4, 4: 2})
Counter({1: 12, 3: 5, 2: 3, 4: 2, 6: 1, 9: 1})
Counter({1: 14, 3: 4, 4: 4, 2: 3, 5: 1, 8: 1, 10: 1})
提升到第二幂,
但此外,我需要选择相应的counter.value()并将其乘以float(i)/m
。如何整合
float(i)/m
进行第二次循环?
counter.values()