Skip to content

Commit 1d8bbb7

Browse files
authored
BUG: fix error message for multiindex.fillna (#60974)
fix error message for multiindex.fillna
1 parent b941927 commit 1d8bbb7

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

Diff for: 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`)

Diff for: 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:

Diff for: pandas/tests/base/test_fillna.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_fillna(index_or_series_obj):
1616
obj = index_or_series_obj
1717

1818
if isinstance(obj, MultiIndex):
19-
msg = "isna is not defined for MultiIndex"
19+
msg = "fillna is not defined for MultiIndex"
2020
with pytest.raises(NotImplementedError, match=msg):
2121
obj.fillna(0)
2222
return

Diff for: pandas/tests/indexes/multi/test_missing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
def test_fillna(idx):
1010
# GH 11343
11-
msg = "isna is not defined for MultiIndex"
11+
msg = "fillna is not defined for MultiIndex"
1212
with pytest.raises(NotImplementedError, match=msg):
1313
idx.fillna(idx[0])
1414

Diff for: pandas/tests/indexes/test_old_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def test_fillna(self, index):
597597
pytest.skip(f"Not relevant for Index with {index.dtype}")
598598
elif isinstance(index, MultiIndex):
599599
idx = index.copy(deep=True)
600-
msg = "isna is not defined for MultiIndex"
600+
msg = "fillna is not defined for MultiIndex"
601601
with pytest.raises(NotImplementedError, match=msg):
602602
idx.fillna(idx[0])
603603
else:

0 commit comments

Comments
 (0)