pandas-dev/pandas · error · ValueError
No accumulation for implemented on BaseMaskedArray
Error message
No accumulation for {func} implemented on BaseMaskedArray What it means
ValueError raised in _cum_func (datetimelike_accumulations) when the requested numpy accumulation function is not one of the supported ones (np.maximum.accumulate, np.cumsum, np.minimum.accumulate). The lookup table of fill values has no entry, indicating an unsupported accumulation on a datetimelike masked array.
Solutions
- Use a supported accumulation on datetimelike data: cumsum, cummin (minimum.accumulate), cummax (maximum.accumulate).
- Convert the values to numeric (e.g. int64 nanoseconds) before applying a different accumulation.
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {'cumsum', 'cummin', 'cummax'}
def safe_cum(s, method):
if method not in SUPPORTED:
raise ValueError(f'{method} is unsupported on datetimelike arrays; use one of {SUPPORTED}')
return getattr(s, method)() Try / catch
try:
s.cumsum()
except ValueError as e:
if 'No accumulation' in str(e):
s.astype('int64').cumsum() # fall back to numeric
else:
raise Prevention
- Restrict datetimelike accumulations to cumsum/cummin/cummax.
- Convert to int64 nanoseconds for custom accumulations.
When it happens
Trigger: Internal dispatch only: cumprod or another unsupported accumulation routed onto a datetimelike (datetime64/timedelta64) masked array.
Common situations: Rare; surfaces when custom array code or monkeypatching invokes an unsupported cum-method on datetime/timedelta data.
Related errors
- No accumulation for implemented on BaseMaskedArray
- No masked accumulation defined for dtype
- Accumulation not supported for
- Accumulation not supported for
- Cannot cast to dtype
AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11).
Data as JSON: /api/errors/c436b2beb515c682.
Report an issue: GitHub.
Appendix: source
Thrown at pandas/core/array_algos/datetimelike_accumulations.py:78
Accumulations for 1D datetimelike arrays.
Parameters
----------
func : np.cumsum, np.maximum.accumulate, np.minimum.accumulate
values : np.ndarray
Numpy array with the values (can be of any dtype that support the
operation). Values is changed is modified inplace.
skipna : bool, default True
Whether to skip NA.
"""
try:
fill_value = {
np.maximum.accumulate: np.iinfo(np.int64).min,
np.cumsum: 0,
np.minimum.accumulate: np.iinfo(np.int64).max,
}[func]
except KeyError as err:
raise ValueError(
f"No accumulation for {func} implemented on BaseMaskedArray"
) from err
mask = isna(values)
y = values.view("i8")
y[mask] = fill_value
if not skipna:
mask = np.maximum.accumulate(mask)
# GH 57956
result = func(y, axis=0)
if func is np.cumsum:
# GH#66551: cummin/cummax cannot leave the range, cumsum can
_check_cumsum_overflow(y, result, mask)
result[mask] = iNaT
if values.dtype.kind in "mM":View on GitHub (pinned to 3b7651241d)