Skip to content

BUG: Fix bug, where BooleanDtype columns are converted to Int64 #32490

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 8 commits into from
Mar 11, 2020

Conversation

AnnaDaglis
Copy link
Contributor

@AnnaDaglis AnnaDaglis changed the title Fixed bug, where BooleanDtype columns were converted to Int64 BUG: Fixed bug, where BooleanDtype columns were converted to Int64 Mar 6, 2020
@AnnaDaglis AnnaDaglis changed the title BUG: Fixed bug, where BooleanDtype columns were converted to Int64 BUG: Fix bug, where BooleanDtype columns were converted to Int64 Mar 6, 2020
@AnnaDaglis AnnaDaglis changed the title BUG: Fix bug, where BooleanDtype columns were converted to Int64 BUG: Fix bug, where BooleanDtype columns are converted to Int64 Mar 6, 2020
@TomAugspurger
Copy link
Contributor

@AnnaDaglis do you think you'll have time to update this soon? We're hoping to get 1.0.2 out in the next couple days. If not, no problem, we'll just move it to the next release.

@jorisvandenbossche
Copy link
Member

Should this entire check be inside a big if not is_extension_array_dtype(input_array.dtype)? There aren't any cases where we want to convert from extension type to extension type, right?

Yes, right now, if the dtype is already an extension dtype, we don't want to change it (in the future, if there is eg a new nullable timestamp dtype, we might want to do this, but that is not yet relevant right now)

@TomAugspurger
Copy link
Contributor

Ha @AnnaDaglis I was just pushing the same changes here. Looks like we ran into the same issue with the Series.astype failing to copy.

Mind if I push some commits here? I think I tracked it down.

@TomAugspurger
Copy link
Contributor

I might end up just force pushing to your branch if that's OK. It'll mess some things up but will be easiest I think.

@AnnaDaglis
Copy link
Contributor Author

@TomAugspurger No problem!

@TomAugspurger TomAugspurger force-pushed the fix_convert_dtypes_bool branch from a302fb2 to 934147b Compare March 10, 2020 14:48
@TomAugspurger
Copy link
Contributor

OK thanks! If you want to sync up, you can git fetch origin and then git reset --hard origin/fix_convert_dtypes_bool when you have that branch checked out locally. Hopefully we're good to go.

@jbrockmendel on master Series.astype() wasn't always copying for datetime64 dtypes. Those changes are in 934147b.

@jbrockmendel
Copy link
Member

nice catch

@TomAugspurger TomAugspurger added Dtype Conversions Unexpected or buggy dtype conversions NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Mar 10, 2020
@TomAugspurger TomAugspurger added this to the 1.0.2 milestone Mar 10, 2020
Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Tagging for 1.0.2 since this is NA related.

@jreback jreback merged commit a2acd1b into pandas-dev:master Mar 11, 2020
@jreback
Copy link
Contributor

jreback commented Mar 11, 2020

thanks @AnnaDaglis very nice!

@jreback
Copy link
Contributor

jreback commented Mar 11, 2020

@meeseksdev backport 1.0.x

@jreback
Copy link
Contributor

jreback commented Mar 11, 2020

@meeseeksdev backport 1.0.x

@lumberbot-app
Copy link

lumberbot-app bot commented Mar 11, 2020

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout 1.0.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 a2acd1b2c662e6ae87e923989df7c0c95444f6d7
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #32490: BUG: Fix bug, where BooleanDtype columns are converted to Int64'
  1. Push to a named branch :
git push YOURFORK 1.0.x:auto-backport-of-pr-32490-on-1.0.x
  1. Create a PR against branch 1.0.x, I would have named this PR:

"Backport PR #32490 on branch 1.0.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@TomAugspurger
Copy link
Contributor

Huh, this seemingly wasn't backported, but the release notes are there... I'll do something manually.

TomAugspurger pushed a commit to TomAugspurger/pandas that referenced this pull request Mar 12, 2020
TomAugspurger added a commit that referenced this pull request Mar 12, 2020
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
@AnnaDaglis AnnaDaglis deleted the fix_convert_dtypes_bool branch March 26, 2020 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions NA - MaskedArrays Related to pd.NA and nullable extension arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: convert_dtypes changes BooleanDtype to Int64
6 participants