Skip to content

Commit 2616c1c

Browse files
committed
fix error message for multiindex.fillna
1 parent fe494c9 commit 2616c1c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ Other
817817
- Bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)
818818
- Bug in :meth:`DataFrame.where` where using a non-bool type array in the function would return a ``ValueError`` instead of a ``TypeError`` (:issue:`56330`)
819819
- Bug in :meth:`Index.sort_values` when passing a key function that turns values into tuples, e.g. ``key=natsort.natsort_key``, would raise ``TypeError`` (:issue:`56081`)
820+
- Bug in :meth:`MultiIndex.fillna` error message was referring to ``isna`` instead of ``fillna`` (:issue:`60974`)
820821
- Bug in :meth:`Series.diff` allowing non-integer values for the ``periods`` argument. (:issue:`56607`)
821822
- Bug in :meth:`Series.dt` methods in :class:`ArrowDtype` that were returning incorrect values. (:issue:`57355`)
822823
- Bug in :meth:`Series.isin` raising ``TypeError`` when series is large (>10**6) and ``values`` contains NA (:issue:`60678`)

pandas/core/indexes/multi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ def fillna(self, value):
17601760
"""
17611761
fillna is not implemented for MultiIndex
17621762
"""
1763-
raise NotImplementedError("isna is not defined for MultiIndex")
1763+
raise NotImplementedError("fillna is not defined for MultiIndex")
17641764

17651765
@doc(Index.dropna)
17661766
def dropna(self, how: AnyAll = "any") -> MultiIndex:

pandas/tests/indexing/multiindex/test_multiindex.py

+5
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,8 @@ def test_groupyby_rename_categories_operation_with_multiindex(self, operation):
249249
expected = getattr(a, operation)(b.sort_index(ascending=False))
250250

251251
tm.assert_series_equal(result, expected)
252+
253+
def test_multiindex_fillna(self):
254+
mi = MultiIndex.from_tuples([("a",)])
255+
with pytest.raises(NotImplementedError, match="fillna"):
256+
mi.fillna(0)

0 commit comments

Comments
 (0)