Skip to content
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

BUG: DataFrame(floatdata, dtype=inty) does unsafe casting #41578

Merged

Conversation

jbrockmendel
Copy link
Member

@simonjayhawkins simonjayhawkins added Bug Dtype Conversions Unexpected or buggy dtype conversions labels May 21, 2021
@@ -1207,6 +1206,19 @@ def astype_nansafe(
return arr.astype(dtype, copy=copy)


def astype_float_to_int_nansafe(
Copy link
Contributor

Choose a reason for hiding this comment

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

this is already done in astype_nansafe and IIRC in Index constructor as well. can you consolidate.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is already done in astype_nansafe

yes, this changes the call in astype_nansafe to use this new function, so that we can use this lighter-weight func in construct_1d_ndarray_preserving_na

and IIRC in Index constructor as well. can you consolidate.

similar but not identical (we also do it a third way for IntegerArray). some combination of #40489 and #40110 i think will make sharing feasible

Copy link
Contributor

Choose a reason for hiding this comment

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

kk great. ok happy to merge here and do followsup.

@jreback jreback added this to the 1.3 milestone May 21, 2021
@jreback jreback merged commit 6dff995 into pandas-dev:master May 21, 2021
@jbrockmendel jbrockmendel deleted the bug-construct_1d_ndarray_preserving_na branch May 21, 2021 15:54
TLouf pushed a commit to TLouf/pandas that referenced this pull request Jun 1, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame(ndarray, dtype=..) does unsafe conversion
3 participants