Skip to content

BUG/REF: unstack with EA dtypes #33356

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 3 commits into from
Apr 10, 2020
Merged

Conversation

jbrockmendel
Copy link
Member

  1. ser.unstack(args) should behave like ser.to_frame().unstack(args).droplevel(level=0, axis=1). This fails on master, is fixed by this PR.
  2. reshape._unstack_extension_series currently re-implements logic that is in ExtensionBlock._unstack. This de-duplicates by dispatching.
  3. We currently transpose in cases where we shouldn't. This implements DataFrame._can_fast_transpose to avoid that.
  4. test_astype_object_series has what looks like a typo that is making us test not-the-intended-thing; @TomAugspurger can you confirm im reading this right?
  5. The dtype comparisons in test_astype_object_frame currently raise, are commented out for exposition, should be fixed in a separate PR.

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.

Thanks. How do the unstack asvs look here?

@@ -10,10 +10,22 @@ class BaseCastingTests(BaseExtensionTests):
"""Casting to and from ExtensionDtypes"""

def test_astype_object_series(self, all_data):
ser = pd.Series({"A": all_data})
ser = pd.Series(all_data, name="A")
Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, that was a bug.

@jbrockmendel
Copy link
Member Author

How do the unstack asvs look here?

with "-b reshape" no change

@jbrockmendel jbrockmendel added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode ExtensionArray Extending pandas with custom dtypes or arrays. labels Apr 9, 2020
@jreback jreback added this to the 1.1 milestone Apr 10, 2020
@jreback jreback merged commit 54f9b03 into pandas-dev:master Apr 10, 2020
@jreback
Copy link
Contributor

jreback commented Apr 10, 2020

thanks nice de-duplicating

@jbrockmendel jbrockmendel deleted the ref-unstack branch April 10, 2020 17:48
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. Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants