{"record":{"id":"c436b2beb515c682","repo":"pandas-dev/pandas","slug":"no-accumulation-for-func-implemented-on-basemask","errorCode":null,"errorMessage":"No accumulation for {func} implemented on BaseMaskedArray","messagePattern":"No accumulation for (.+?) implemented on BaseMaskedArray","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pandas/core/array_algos/datetimelike_accumulations.py","lineNumber":78,"sourceCode":"    Accumulations for 1D datetimelike arrays.\n\n    Parameters\n    ----------\n    func : np.cumsum, np.maximum.accumulate, np.minimum.accumulate\n    values : np.ndarray\n        Numpy array with the values (can be of any dtype that support the\n        operation). Values is changed is modified inplace.\n    skipna : bool, default True\n        Whether to skip NA.\n    \"\"\"\n    try:\n        fill_value = {\n            np.maximum.accumulate: np.iinfo(np.int64).min,\n            np.cumsum: 0,\n            np.minimum.accumulate: np.iinfo(np.int64).max,\n        }[func]\n    except KeyError as err:\n        raise ValueError(\n            f\"No accumulation for {func} implemented on BaseMaskedArray\"\n        ) from err\n\n    mask = isna(values)\n    y = values.view(\"i8\")\n    y[mask] = fill_value\n\n    if not skipna:\n        mask = np.maximum.accumulate(mask)\n\n    # GH 57956\n    result = func(y, axis=0)\n    if func is np.cumsum:\n        # GH#66551: cummin/cummax cannot leave the range, cumsum can\n        _check_cumsum_overflow(y, result, mask)\n    result[mask] = iNaT\n\n    if values.dtype.kind in \"mM\":","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/array_algos/datetimelike_accumulations.py#L60-L96","documentation":"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.","triggerScenarios":"Internal dispatch only: cumprod or another unsupported accumulation routed onto a datetimelike (datetime64/timedelta64) masked array.","commonSituations":"Rare; surfaces when custom array code or monkeypatching invokes an unsupported cum-method on datetime/timedelta data.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"SUPPORTED = {'cumsum', 'cummin', 'cummax'}\ndef safe_cum(s, method):\n    if method not in SUPPORTED:\n        raise ValueError(f'{method} is unsupported on datetimelike arrays; use one of {SUPPORTED}')\n    return getattr(s, method)()","typeGuard":null,"tryCatchPattern":"try:\n    s.cumsum()\nexcept ValueError as e:\n    if 'No accumulation' in str(e):\n        s.astype('int64').cumsum()  # fall back to numeric\n    else:\n        raise","preventionTips":["Restrict datetimelike accumulations to cumsum/cummin/cummax.","Convert to int64 nanoseconds for custom accumulations."],"tags":["internal","accumulation","datetimelike"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}