I came across the same problem and wanted to elaborate on Anatoly's answer for how to get around this. As mentioned, .accumulate is not supported by numba. However, the numpy documentation on .accumulate provides a hint:
For a one-dimensional array, accumulate produces results equivalent to:
r = np.empty(len(A))
t = op.identity # op = the ufunc being applied to A's elements
for i in range(len(A)):
t = op(t, A[i])
r[i] = t
return r
So, let's first convert this to a proper function:
def numba_maximum_accumulate(A):
r = np.empty(len(A))
t = op.identity
for i in range(len(A)):
t = op(t, A[i])
r[i] = t
return r
Next, we swap out op for our desired operation np.maximum
def numba_maximum_accumulate(A):
r = np.empty(len(A))
t = np.maximum.identity
for i in range(len(A)):
t = mp.maximum(t, A[i])
r[i] = t
return r
However, we'll quickly learn that the identity of np.maximum is None and this is undesirable and, instead, we should seed this process by simply setting t = np.-inf (Note that in the case of np.minimum, you'll want to seed with t = np.inf instead).
def numba_maximum_accumulate(A):
r = np.empty(len(A))
t = -np.inf
for i in range(len(A)):
t = mp.maximum(t, A[i])
r[i] = t
return r
Finally, let's JIT our function:
from numba import njit
@njit()
def numba_maximum_accumulate(A):
r = np.empty(len(A))
t = -np.inf
for i in range(len(A)):
t = mp.maximum(t, A[i])
r[i] = t
return r
Now you should be able to call this function on your data.