-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix(python): raise error when pandas df's some index name duplicates some column name #16023
Conversation
…ates column name (#15938)
…ates column name (#15938) - improve readability
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16023 +/- ##
=======================================
Coverage 80.91% 80.92%
=======================================
Files 1385 1385
Lines 178224 178227 +3
Branches 3050 3051 +1
=======================================
+ Hits 144212 144227 +15
+ Misses 33522 33512 -10
+ Partials 490 488 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…ates column name (#15938) - handle multiindex
Thanks for your feedback @mcrumiller ! I have addressed your concerns (update code to handle MultiIndex, moved tests to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your pr, not sure this is general enough
@@ -1020,6 +1020,11 @@ def pandas_to_pydf( | |||
) -> PyDataFrame: | |||
"""Construct a PyDataFrame from a pandas DataFrame.""" | |||
convert_index = include_index and not _pandas_has_default_index(data) | |||
if convert_index and set(data.index.names).intersection(data.columns): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Polars converts non-string column names to string
I think a more generic solution is needed, to handle #16025 too
Fix #15938 : raise ValueError when converting from pandas DF, whose index name duplicates some column name @MarcoGorelli