{"record":{"id":"cc1d8790f122443a","repo":"pandas-dev/pandas","slug":"operation-name-not-supported-for-dtype-self-cc1d87","errorCode":null,"errorMessage":"operation '{name}' not supported for dtype '{self.dtype}'","messagePattern":"operation '(.+?)' not supported for dtype '(.+?)'","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/string_.py","lineNumber":1010,"sourceCode":"            - cumsum\n            - cumprod\n        skipna : bool, default True\n            If True, skip NA values.\n        **kwargs\n            Additional keyword arguments passed to the accumulation function.\n            Currently, there is no supported kwarg.\n\n        Returns\n        -------\n        array\n\n        Raises\n        ------\n        NotImplementedError : subclass does not define accumulations\n        \"\"\"\n        if name == \"cumprod\":\n            msg = f\"operation '{name}' not supported for dtype '{self.dtype}'\"\n            raise TypeError(msg)\n\n        # We may need to strip out trailing NA values\n        tail: np.ndarray | None = None\n        na_mask: np.ndarray | None = None\n        ndarray = self._ndarray\n        np_func = {\n            \"cumsum\": np.cumsum,\n            \"cummin\": np.minimum.accumulate,\n            \"cummax\": np.maximum.accumulate,\n        }[name]\n\n        if self._hasna:\n            na_mask = cast(\"npt.NDArray[np.bool_]\", isna(ndarray))\n            if np.all(na_mask):\n                return type(self)(ndarray, dtype=self.dtype)\n            if skipna:\n                if name == \"cumsum\":\n                    ndarray = np.where(na_mask, \"\", ndarray)","sourceCodeStart":992,"sourceCodeEnd":1028,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/core/arrays/string_.py#L992-L1028","documentation":"StringArray._accumulate supports cumsum, cummin, cummax but explicitly forbids cumprod, raising TypeError. A cumulative product of strings is undefined, so the operation is rejected up front rather than producing garbage.","triggerScenarios":"Calling string_series.cumprod(), or df.cumprod() on a DataFrame that includes a string column, or any accumulation pipeline that runs cumprod across all columns.","commonSituations":"Generic df.cumprod() calls; accumulation utilities applied uniformly; mistakenly treating string-encoded numbers as numeric without conversion.","solutions":["Do not call cumprod on string data.","Convert numeric strings first: s.astype(float).cumprod().","Exclude string columns from cumprod via select_dtypes."],"exampleFix":"// before\nstring_series.cumprod()\n\n// after\nstring_series.astype(float).cumprod()","handlingStrategy":"validation","validationCode":"if name == 'cumprod':\n    raise TypeError('cumprod is not supported for string dtype')","typeGuard":"def is_supported_accumulation(name: str) -> bool:\n    return name in {'cumsum', 'cummin', 'cummax'}","tryCatchPattern":null,"preventionTips":["Never call cumprod on string data.","Convert numeric strings via astype(float) before cumulative product.","Exclude string columns from generic cumprod pipelines."],"tags":["string-array","accumulate","type-error","cumprod"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}