Skip to content

BUG: Series.rename raises error on values accepted by Series construc… #27814

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 7 commits into from
Aug 22, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
TST: renaming Series with custom indexer #27814
  • Loading branch information
lgmsantos committed Aug 8, 2019
commit 0d742fe79911bf65f14f60db8655d449ae273d79
13 changes: 13 additions & 0 deletions pandas/tests/series/test_alter_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ def test_rename_axis_none(self, kwargs):
expected = Series([1, 2, 3], index=expected_index)
tm.assert_series_equal(result, expected)

def test_rename_custom_indexer(self):
# GH 27814

class MyIndexer: pass

ix1, ix2 = MyIndexer(), MyIndexer()
s = Series([1, 2, 3])
s = s.rename(ix1)
assert s.name is ix1

s.rename(ix2, inplace=True)
assert s.name is ix2

def test_set_axis_inplace_axes(self, axis_series):
# GH14636
ser = Series(np.arange(4), index=[1, 3, 5, 7], dtype="int64")
Expand Down