-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
TST: df.set_axis() and rename_axis() not failing when allows_duplicate_labels=False #63135
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,20 @@ def test_rename_axis_inplace(self, float_frame): | |
| assert no_return is None | ||
| tm.assert_frame_equal(result, expected) | ||
|
|
||
| def test_rename_axis_with_allows_duplicate_labels_false(self): | ||
| # GH#44958 | ||
| # Test that rename_axis() works correctly when allows_duplicate_labels=False | ||
| df = DataFrame([[1, 2], [3, 4]], columns=["a", "b"]).set_flags( | ||
| allows_duplicate_labels=False | ||
| ) | ||
|
|
||
| # Test renaming index (axis=0) with allows_duplicate_labels=False | ||
| result = df.rename_axis("idx", axis=0) | ||
| expected = DataFrame( | ||
| [[1, 2], [3, 4]], index=Index([0, 1], name="idx"), columns=["a", "b"] | ||
| ).set_flags(allows_duplicate_labels=False) | ||
|
||
| tm.assert_frame_equal(result, expected) | ||
|
|
||
| def test_rename_axis_raises(self): | ||
| # GH#17833 | ||
| df = DataFrame({"A": [1, 2], "B": [1, 2]}) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.