-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
MRG respect dtypes in pandas dataframes if homogeneous #15094
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
MRG respect dtypes in pandas dataframes if homogeneous #15094
Conversation
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.
Yes, might as well have a change log entry
Misfire |
EDIT: never mind. |
Correction: passing float16 to |
Ok I think I'm confused whether |
ok now this resolves anything pandas-related. It leaves the numpy-casting as it was, so we're still casting int32 to float64, not float32. |
CI failures, but I agree with your changes |
If |
It's actually basically impossible to correctly sniff out the types right now: |
green again yay |
# check that we handle pandas dtypes in a semi-reasonable way | ||
# this is actually tricky because we can't really know that this | ||
# should be integer ahead of converting it. | ||
assert (check_array(pd.DataFrame([pd.Categorical([1, 2, 3])])).dtype |
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.
For completeness, should we test for dtype=FLOAT_DTYPES
as well?
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.
an check what? That it's float64?
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.
Right above this check we check that a int16 dataframe is casted to float64. It seems reasonable to test that this categorical goes to float64 as well.
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.
done.
@jnothman still good? |
…r/scikit-learn into respect_pandas_homogeneous_dtype
Thanks! |
Fixes #15093.
Does that deserve/need a whatsnew?