IndexError on calculating deviations and choosing the Ideal functions

I have my Python code for calculating deviations and choosing the Ideal functions. So from the minimum deviations I am getting this error:

chosen_function_index = best_fit_functions[min_deviation_index]
IndexError: index 1008 is out of bounds for axis 0 with size 4

Any ideas on how I can resolve this?

Hi check the size of your list or array. I think you’re trying to access an element in an iterable like a list or array using an index that is larger than the size of the list or array.

It looks like best_fit_functions has a size of 4, but you’re trying to access the element at index 1008, which is causing the IndexError. Thats why its ‘out of bounds’.

Thanks for that. :+1: