Ref: https://docs.scipy.org/doc/numpy/reference/generated/numpy.prod.html
input
"""
Created on Thu May 25 20:30:54 2017
@author: Bruce Lau
"""
# -*- coding: utf-8 -*-
import numpy as np
a = np.arange(9).reshape(3,3)
b = np.prod(a,axis = 0)
c = np.prod(a,axis = 1)
print('\n','the original matrix is')
print(a)
print('\n','multiply elemens along axis = 0')
print(b)
print('\n','multiply elemens along axis = 1')
print(c)
output
the original matrix is
[[0 1 2]
[3 4 5]
[6 7 8]]
multiply elemens along axis = 0
[ 0 28 80]
multiply elemens along axis = 1
[ 0 60 336]