fix(python): Raise for overlapping index/column names in pandas dataframes post string coercion #17628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Polars team, this pr does 3 main things. First, it solves for #15938 and #16023 , by checking the stringified index names for overlap w/column names. Second, it solves for duplicated index names, post string conversion. For example, an index of 0 and '0' would not be caught without this explicit check. Third, I combine this logic with the code I wrote for issue #16025 , because I considered this all a part of the same general problem.
I altered some unit tests to include the new error message, two of which I already altered for my pr on #16025 . I wrote/borrowed a new unit test that was written directly from the desired behavior in #15938 .
Let me know if you need anything else. I'd love for any feedback on the code, if there's anything you'd change.
Thank you.