I have a list of lists
my_list = [[8,2,3], [8,3,6], [2,3,9], [7,3,6], [2,6,4], [8,5,8]]
and would like to take the average of the last n
entries of the list for each of its entries. To clarify, here is an example:
The average of the entries of the last 3 lists of my_list
is:
[(7+2+8)/3, (3+6+5)/3, (6+4+8)/3] = [5.67, 4.67, 6]
I did it with a bunch of loops of loops but I feel like there is a way to do it in probably a line or two of code. Any help is appreciated. Thanks