Python multiply list of lists element-wise

list, numpy, python

Solution

Use `np.prod`:

>>> a = np.array([[1,2,3],[2,3,4],[3,4,5]])
>>> np.prod(a,axis=1)
array([ 6, 24, 60])

Problem

What is the neatest way to multiply element-wise a list of lists of numbers? E.g. ``` [[1,2,3],[2,3,4],[3,4,5]] -> [6,24,60] ```

Original source