У меня есть сценарий ниже, который должен вызвать что-то вроде:
5 average
---> No range de 12 ocorrências (taxa) ----> in block 60 occurrences
5 stantard derivation
Пример:
[[[69, 2.0], [69, 2.0], [64, 3.872983346207417], [71, 1.4142135623730951], [80, 4.0]], [[69, 2.0], [69, 2.0], [64, 3.872983346207417], [71, 1.4142135623730951], [80, 4.0]], [[69, 2.0], [69, 2.0], [64, 3.872983346207417], [71, 1.4142135623730951], [80, 4.0]]]
Но он возвращает мне это:
[[], [], [], []]
Есть предложения по проблеме?
Не понимаю, почему после очистки временного списка очищается и основной
Данные для вставки:
[68 68 69 68 69 70 71 75 72 73 72 72 73 72 72 73 70 71 73 72 72 71 69 68
69 68 69 68 69 68 68 68 68 69 68 69 70 71 75 72 69 68 68 68 69 68 69 70
71 75 72 69 68 69 68 69 68 69 68 68 60 60 61 60 61 65 69 69 72 73 72 72
73 72 72 73 70 71 73 75 78 80 82 84 87 84 84 83 82 79 78 76 74 73 72 72
72 71 75 72 69 68 68 68 69 68 69 70 71 75 72 69 68 69 68 69 68 69 68 68]
Скрипт:
def standardDeviation(data):
return statistics.stdev(data)
def mean(data):
return statistics.mean(data)
def captureOcurrences(elements, n):
L = len(elements)
return [elements[i: i+n] for i in range(0, L, n)]
def input(elements):
result = []
temp = []
start = 0
limit = 60
size = int(len(elements))
TargetDivision = int(size / 30)
repetitions = 0
five = 0
while repetitions < TargetDivision:
five += 1
ocurrences = captureOcurrences(elements[start: limit],12)
for i in ocurrences:
print("[INFO] 12 Ocurrences: {}".format(i))
print("[INFO] Mean: {}".format(mean(i)))
m = mean(i)
print("[INFO] Standard Deviation: {}".format(standardDeviation(i)))
sd = standardDeviation(i)
print("Result: [{},{}]\n\n".format(m,sd))
temp.append([m,sd])
print("[INFO] Result Cycle {}: \n{}\n\n".format(repetitions+1,result))
result.append(temp)
temp.clear()
repetitions += 1
limit += 10
start += 10
return result
Y = data.iloc[:, 1].values
print(input(Y))