{"record":{"id":"a2937b138f76ab13","repo":"pandas-dev/pandas","slug":"extensionarray-fillna-does-not-support-filling-wit-a2937b","errorCode":null,"errorMessage":"ExtensionArray.fillna does not support filling with a dict. Use Series.fillna instead.","messagePattern":"ExtensionArray\\.fillna does not support filling with a dict\\. Use Series\\.fillna instead\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/interval.py","lineNumber":899,"sourceCode":"            values for each index. The value should not be a list. The\n            value(s) passed should be either Interval objects or NA/NaN.\n        limit : int, default None\n            (Not implemented yet for IntervalArray)\n            The maximum number of entries where NA values will be filled.\n        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        ----------","sourceCodeStart":881,"sourceCodeEnd":917,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/core/arrays/interval.py#L881-L917","documentation":"Raised as a TypeError by `IntervalArray.fillna` when `value` is a dict. Dict-based filling (per-label) is a Series-level concept and is not implemented on the bare ExtensionArray. Fires at pandas/core/arrays/interval.py:899.","triggerScenarios":"`ia.fillna({0: pd.Interval(0,1)})`, or calling `.fillna` on the `.values` of a Series with a dict.","commonSituations":"Calling `.values.fillna({...})` instead of the Series method; copy-pasting a Series fillna pattern onto the array.","solutions":["Call fillna on the Series: `s.fillna({...})`.","If working on the array, fill with a single scalar Interval: `ia.fillna(pd.Interval(0,1))`.","Map positions manually: build new left/right arrays and reconstruct the IntervalArray."],"exampleFix":"// before\nia.fillna({0: pd.Interval(0, 1)})\n// after\npd.Series(ia).fillna({0: pd.Interval(0, 1)}).values","handlingStrategy":"validation","validationCode":"def fillna_interval(ia, value):\n    import pandas as pd\n    if isinstance(value, dict):\n        return pd.Series(ia).fillna(value).values\n    return ia.fillna(value)","typeGuard":"def is_dict_value(value) -> bool:\n    return isinstance(value, dict)","tryCatchPattern":"try:\n    out = ia.fillna(value)\nexcept TypeError as e:\n    if \"does not support filling with a dict\" in str(e):\n        out = pd.Series(ia).fillna(value).values\n    else:\n        raise","preventionTips":["Call fillna on the Series, not on .values, when using a dict.","Pass a single scalar Interval to IntervalArray.fillna.","Wrap interval columns as Series throughout the pipeline."],"tags":["interval","fillna","dict","extension-array"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}