Preserve Extension type on cross section
State: closed

closes #22784 

Builds on #22780 (first commit).

0197e0c has the relevant changes.

Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
Hello @TomAugspurger! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/core/base.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/core/base.py) !

 - There are no PEP8 issues in the file [`pandas/core/frame.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/core/frame.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/multi.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/core/indexes/multi.py) !

 - There are no PEP8 issues in the file [`pandas/core/internals/managers.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/core/internals/managers.py) !

 - There are no PEP8 issues in the file [`pandas/tests/frame/test_dtypes.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/tests/frame/test_dtypes.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexing/test_indexing.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/tests/indexing/test_indexing.py) !

 - There are no PEP8 issues in the file [`pandas/tests/indexing/test_multiindex.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/tests/indexing/test_multiindex.py) !

 - There are no PEP8 issues in the file [`pandas/tests/series/test_dtypes.py`](https://github.com/TomAugspurger/pandas/blob/b0514245d12f63f3f77ad2c88c0025fb64a0f174/pandas/tests/series/test_dtypes.py) !



##### Comment last updated on September 20, 2018 at 16:50 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22785?src=pr&el=h1) Report
> Merging [#22785](https://codecov.io/gh/pandas-dev/pandas/pull/22785?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/739e6be23431ae5263ebbc0c35d30c0afd05951f?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22785/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22785?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #22785      +/-   ##
==========================================
- Coverage   92.19%   92.18%   -0.01%     
==========================================
  Files         169      169              
  Lines       50825    50806      -19     
==========================================
- Hits        46857    46836      -21     
- Misses       3968     3970       +2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.6% <100%> (-0.01%)` | :arrow_down: |
| #single | `42.33% <60%> (-0.05%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22785?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9tdWx0aS5weQ==) | `95.45% <ø> (ø)` | :arrow_up: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `97.61% <ø> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.2% <ø> (ø)` | :arrow_up: |
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `96.66% <100%> (+0.1%)` | :arrow_up: |
| [pandas/core/groupby/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9iYXNlLnB5) | `91.11% <0%> (-0.73%)` | :arrow_down: |
| [pandas/io/parquet.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnF1ZXQucHk=) | `73.04% <0%> (-0.69%)` | :arrow_down: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `97.07% <0%> (-0.3%)` | :arrow_down: |
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.78% <0%> (-0.19%)` | :arrow_down: |
| [pandas/core/window.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvd2luZG93LnB5) | `96.28% <0%> (-0.12%)` | :arrow_down: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.54% <0%> (-0.06%)` | :arrow_down: |
| ... and [12 more](https://codecov.io/gh/pandas-dev/pandas/pull/22785/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22785?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22785?src=pr&el=footer). Last update [739e6be...78dd81e](https://codecov.io/gh/pandas-dev/pandas/pull/22785?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

cc @jreback for 78798cf
With the caveats that a) I generally trust @TomAugspurger to know what he's doing and b) this can wait until the upcoming chat: wouldn't it be simpler just to allow EA to support 2D arrays?  I expect we're going to have to go that way eventually for #22614 etc
I'm still a bit hesitant about 2D extension arrays, since it pushes additional complexity on the implementations,  and goes a bit against our (someday?) goal of removing the BlockManager in favor of a simpler data structure. But I'll read through #22614 and related issues, and try to collect my thoughts.
I think everything has been addressed. Merging in a few hours.
I am fine with merging now, if that makes it easier for updating your sparse PR