Skip to content

BUG fix IntegerArray.astype int -> uint #22441

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

Merged
merged 2 commits into from
Aug 22, 2018

Conversation

jorisvandenbossche
Copy link
Member

Closes #22440

@jorisvandenbossche jorisvandenbossche added Bug ExtensionArray Extending pandas with custom dtypes or arrays. labels Aug 21, 2018
@@ -409,8 +409,7 @@ def astype(self, dtype, copy=True):

# if we are astyping to an existing IntegerDtype we can fastpath
if isinstance(dtype, _IntegerDtype):
result = self._data.astype(dtype.numpy_dtype,
casting='same_kind', copy=False)
Copy link
Member Author

Choose a reason for hiding this comment

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

@jreback do you remember what the reason was to explicitly put casting='same_kind' ?

Copy link
Contributor

Choose a reason for hiding this comment

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

iirc was to make sure we were
only coercing actual ints (and would raise on floats)

Copy link
Member Author

Choose a reason for hiding this comment

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

But since we have the if isinstance(dtype, _IntegerDtype):, we are sure about that? (so it can never be a float dtype)

Copy link
Contributor

Choose a reason for hiding this comment

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

it might have been an artificat.

@codecov
Copy link

codecov bot commented Aug 21, 2018

Codecov Report

Merging #22441 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22441   +/-   ##
=======================================
  Coverage   92.05%   92.05%           
=======================================
  Files         169      169           
  Lines       50733    50733           
=======================================
  Hits        46702    46702           
  Misses       4031     4031
Flag Coverage Δ
#multiple 90.46% <100%> (ø) ⬆️
#single 42.24% <0%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/arrays/integer.py 94.55% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68273a7...26afccf. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Aug 22, 2018
@jreback jreback merged commit 1584530 into pandas-dev:master Aug 22, 2018
@jreback
Copy link
Contributor

jreback commented Aug 22, 2018

thanks!

@jorisvandenbossche jorisvandenbossche deleted the integer-array-casting branch August 22, 2018 10:19
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants