Skip to content

BUG: fix error message for multiindex.fillna #60974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading