Skip to content

Commit

Permalink
BUG: fix error message for multiindex.fillna (#60974)
Browse files Browse the repository at this point in the history
fix error message for multiindex.fillna
  • Loading branch information
MarcoGorelli authored Feb 20, 2025
1 parent b941927 commit 1d8bbb7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ Other
- Bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)
- 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`)
- 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`)
- Bug in :meth:`MultiIndex.fillna` error message was referring to ``isna`` instead of ``fillna`` (:issue:`60974`)
- Bug in :meth:`Series.diff` allowing non-integer values for the ``periods`` argument. (:issue:`56607`)
- Bug in :meth:`Series.dt` methods in :class:`ArrowDtype` that were returning incorrect values. (:issue:`57355`)
- Bug in :meth:`Series.isin` raising ``TypeError`` when series is large (>10**6) and ``values`` contains NA (:issue:`60678`)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ def fillna(self, value):
"""
fillna is not implemented for MultiIndex
"""
raise NotImplementedError("isna is not defined for MultiIndex")
raise NotImplementedError("fillna is not defined for MultiIndex")

@doc(Index.dropna)
def dropna(self, how: AnyAll = "any") -> MultiIndex:
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/base/test_fillna.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_fillna(index_or_series_obj):
obj = index_or_series_obj

if isinstance(obj, MultiIndex):
msg = "isna is not defined for MultiIndex"
msg = "fillna is not defined for MultiIndex"
with pytest.raises(NotImplementedError, match=msg):
obj.fillna(0)
return
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/multi/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def test_fillna(idx):
# GH 11343
msg = "isna is not defined for MultiIndex"
msg = "fillna is not defined for MultiIndex"
with pytest.raises(NotImplementedError, match=msg):
idx.fillna(idx[0])

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/test_old_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def test_fillna(self, index):
pytest.skip(f"Not relevant for Index with {index.dtype}")
elif isinstance(index, MultiIndex):
idx = index.copy(deep=True)
msg = "isna is not defined for MultiIndex"
msg = "fillna is not defined for MultiIndex"
with pytest.raises(NotImplementedError, match=msg):
idx.fillna(idx[0])
else:
Expand Down

0 comments on commit 1d8bbb7

Please sign in to comment.