I've done a bit of research on this error but I still haven't been able to fix it. I've tried different syntax and codes. The error seems to be on lines mean_value= and std_value=.
# Moving Mean
for i in enumerate(inputs_filtered):
mean_value = sum(inputs_filtered[i-smoothing:i])/smoothing
# Standard Deviation
for i in enumerate(inputs_filtered):
std_value = math.sqrt(sum((inputs_filtered[i-smoothing:i])-mean_value)/smoothing)
Your problem is that using
enumerate
on a list is returning a tuple and not justi
as you expected, it returns the index, and the value of that index.so in your case,
i
is a tuple, and you're trying to subtractsmoothing
off of a tuplee.g:
If you need to iterate and fetch the value for every index, use: