-
Notifications
You must be signed in to change notification settings - Fork 883
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
Preserve DataFrame(columns=).columns dtype during empty-like construction #14381
Preserve DataFrame(columns=).columns dtype during empty-like construction #14381
Conversation
python/cudf/cudf/core/dataframe.py
Outdated
if len(columns) == 0: | ||
empty_dtype = getattr(columns, "dtype", None) | ||
else: | ||
empty_dtype = None |
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.
If the columns are non-empty and have a dtype, should we respect that? It feels like there are still times in which we might lose the dtype, or do I have it wrong?
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.
Good point. Currently a column passed in as int8
would be returned as int64
. I'll push an update to avoid this upcasting
In a followup, I have a feeling |
…me/empty_column_type
…me/empty_column_type
/merge |
Description
.column
used to always returnpd.Index([], dtype=object)
even if an empty-dtyped columns was passed into the DataFrame constructor e.g.DatetimeIndex([])
. Needed to preserved some information about what column dtype was passed in so we can return a correctly type IndexChecklist