I have a list of size (201, 201) and i would like to calculate the mean of every 9 elements inside my list. For instance [[1, 2, 3, 4, 5, 6, 7, 8, 9], [10, 11, 12, 13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24, 25, 26, 27], [28, 29, 30, 31, 32, 33, 34, 35], [36, 37, 38, 39, 40, 41, 42, 43, 44, 45]]
. I am expecting an output like this:
[5, 14, 23, 28, 45]
I followed this question for example but unfortunately the question deals with arrays: Averaging over every n elements of a numpy array
I also followed this question: Python - Average every "n" elements in a list, but it calculates the mean from n+1 to n elements.
Im looking for a reproducible example for the list above for instance, that is a start for me i guess