You can create a universal numpy functions, known as a ufunc, using numba.
from numba import vectorize, float64, float32
@vectorize([float64(float64, float64), float32(float32, float32)])
def cumprod(x, y):
return x * y
This function can now use axes.
cumprod.accumulate(arr, axis=0)
cumprod.accumulate(arr, axis=1)
cumprod.reduce(arr, axis=0)
cumprod.reduce(arr, axis=1)