Skip to content

Conversation

@kubaszkliniarz
Copy link
Contributor

@kubaszkliniarz kubaszkliniarz commented Nov 17, 2025

@natmokval natmokval added the Needs Tests Unit test(s) needed to prevent regressions label Nov 17, 2025
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment:
I think we can define the expected DataFrame without specifying set_flags. Instead, in the assertion statement we can use check_flags=False.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, looks much cleaner, thank you

@natmokval
Copy link
Contributor

LGTM. @WillAyd, could you please take a look at these tests?

@WillAyd WillAyd merged commit ff8d694 into pandas-dev:main Nov 18, 2025
41 checks passed
@WillAyd
Copy link
Member

WillAyd commented Nov 18, 2025

Thanks @kubaszkliniarz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Tests Unit test(s) needed to prevent regressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.set_axis() and rename_axis() fail if allows_duplicate_labels=False

3 participants