I have to find mean of each list in a list of lists. I am using numpy. I tried
numpy.mean(a, axis=1)
It works fine when all lists are equal in length.
In my case each list may be of different length. It is giving
IndexError: `tuple index out of range`
Code to reproduce
import numpy
data = numpy.array([[1,2,3], [4,6]])
print(numpy.mean(data, axis=1))
Desired output
[ 2. 5.]