I have a CSV file, structured in two columns: "Time.s", "Volt.mv". Example: 0, 1.06 0.0039115, 1.018 0.0078229, 0.90804
So, I have to return time values that exceed the threshold of 0.95 indicating the deviation of each value with respect to the average of that time interval.
I calculated the average like this:
ecg_time_mean = ecg["Time.s"].mean()
print(ecg_time_mean)
Then, I tried to make a For Loop with condition:
ecg_dev = []
for elem in ecg["Time.s"]:
if elem > 0.95:
deviation = ecg["Time.s"].std()
sqrt = deviation**(1/2.0)
dev = sqrt/ecg_time_mean
ecg_dev.append(elem)
ecg["Deviation"] = dev
print(ecg)
And I would like to print the output in a new column called "Deviation". This is the output: no If Condition taken into consideration and column Deviation with the same number in each row.
I can't understand the problem. Thank you in advance, guys!