我正在尝试计算每个值从 1-c1 到 4 的百分比变化bench
。每个的值bench
都pythonic list
类似于lists = [[],[],[],[],[],[]]
python中是否有一个库或任何统计包可以帮助我轻松地做到这一点?
"bench" "1-c1", "1-c3", "1-c6", "1-c7", "1-poll", "1", "2-c1", "2-c3", "2-c6", "2-c7", "2-poll", "2", "3-c1", "3-c3", "3-c6", "3-c7", "3-poll", "3", "4-c1", "4-c3", "4-c6", "4-c7", "4-poll", "4"
a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
b 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
d 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
e 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
f 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
请。让我知道是否有不清楚的地方
lists = [
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
]
这就是列表的样子
Paulo,作为对您的评论的回应,我希望 % 从lists[0][0] to lists[n][n]
感谢Paulo
. 我可以改进我的解决方案
listi = []
iter = []
percentage = [[],[],[],[],[]]
def increase_decrease(lists):
for data in range(0,len(lists)):
listi.append(lists[data][0])
for row in listi:
iterations = list(itertools.product(row,row))
iter.append(iterations)
for b in range(0, len(iter)):
for a in range(0, len(iter[0])):
if (iter[b][a][0] != iter[b][a][1]) and (iter[b][a][0] > iter[b][a][1]):
percentage[b].append(float(float(float(iter[b][a][0] - iter[b][a][1])/iter[b][a][0]))*100)
if (iter[b][a][0] != iter[b][a][1]) and (iter[b][a][0] < iter[b][a][1]):
percentage[b].append(float(float(float(iter[b][a][1] - iter[b][a][0])/iter[b][a][1]))*100)
print percentage[b]
任何其他更改将不胜感激。谢谢你。