{"record":{"id":"0e0be8c17d271dd8","repo":"pandas-dev/pandas","slug":"limit-must-be-none","errorCode":null,"errorMessage":"limit must be None","messagePattern":"limit must be None","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/interval.py","lineNumber":904,"sourceCode":"        copy : bool, default True\n            Whether to make a copy of the data before filling. If False, then\n            the original should be modified and no new memory should be allocated.\n            For ExtensionArray subclasses that cannot do this, it is at the\n            author's discretion whether to ignore \"copy=False\" or to raise.\n\n        Returns\n        -------\n        filled : IntervalArray with NA/NaN filled\n        \"\"\"\n        if copy is False:\n            raise NotImplementedError\n        if isinstance(value, dict):\n            raise TypeError(\n                \"ExtensionArray.fillna does not support filling with a dict. \"\n                \"Use Series.fillna instead.\"\n            )\n        if limit is not None:\n            raise ValueError(\"limit must be None\")\n\n        value_left, value_right = self._validate_setitem_value(value)\n\n        left = self.left.fillna(value=value_left)\n        right = self.right.fillna(value=value_right)\n        return self._shallow_copy(left, right)\n\n    def astype(self, dtype, copy: bool = True):\n        \"\"\"\n        Cast to an ExtensionArray or NumPy array with dtype 'dtype'.\n\n        Parameters\n        ----------\n        dtype : str or dtype\n            Typecode or data-type to which the array is cast.\n\n        copy : bool, default True\n            Whether to copy the data, even if not necessary. If False,","sourceCodeStart":886,"sourceCodeEnd":922,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/arrays/interval.py#L886-L922","documentation":"Raised by IntervalArray.fillna when the 'limit' keyword is not None. Filling a capped number of NA entries is explicitly unsupported on IntervalArray (documented as 'Not implemented yet'), so the method rejects the argument outright rather than silently ignoring it. Use Series.fillna or implement the cap manually.","triggerScenarios":"Calling interval_array.fillna(value, limit=5); calling Series.fillna(..., limit=N) on a Series whose dtype is an IntervalDtype; passing limit unconditionally in dtype-agnostic fillna code.","commonSituations":"Generic NA-filling helpers templated across dtypes that always forward limit; porting numeric fillna code to interval-backed Series.","solutions":["Drop the 'limit' argument when calling fillna on an IntervalArray or interval-backed Series.","If you need a cap, fill all NAs then mask/truncate the changed positions yourself.","Use Series.fillna and post-process if you must respect a cap."],"exampleFix":"// before\narr.fillna(pd.Interval(0, 1), limit=3)\n// after\narr.fillna(pd.Interval(0, 1))","handlingStrategy":"validation","validationCode":"def safe_fillna(arr, value, limit=None):\n    import pandas as pd\n    if limit is not None and isinstance(arr, pd.arrays.IntervalArray):\n        raise ValueError(\n            'limit unsupported for IntervalArray.fillna; drop it or cap manually'\n        )\n    return arr.fillna(value, limit=limit)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the array dtype before forwarding 'limit' to fillna.","Prefer Series.fillna for generic cross-dtype NA-filling code.","Treat IntervalArray.fillna as supporting value only - not limit."],"tags":["interval-array","fillna","limit","not-implemented"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}