CLN: move top-level dirs
State: closed

xref #13634

- [x] ``from pandas.types.concat import union_categoricals`` ?

- ``pandas.types`` -> ``pandas.core.typed``
- ``pandas.computation`` -> ``pandas.core.computation``
- ``pandas.sparse`` -> ``pandas.core.sparse``

Labels:
name: Clean

Comments:
this was probably the one with the most actual code changes.
``from pandas.types.concat import union_categoricals``
we need to change this.

``from pandas.api import union_categoricals``?

also should change ``infer_dtype`` to come from ``pandas.api`` as well? (xref #15936) (I will do as a followup I think).
cc @chris-b1 @jorisvandenbossche 
I suppose `union_categoricals` and `infer_dtype` should go in `pandas.api.types`?
yep I think that's right place.
Is there a reason you use `core.typed` instead of `core.types` ?
> Is there a reason you use core.typed instead of core.types ?

yes, unfortunately in python 2 if you do ``import types`` and you are *in*  the ``pandas.core`` directly you get ``pandas.core.types``, rather than the built in module (it get shadowed). This is a bit annoying because it *does* work in python 3 :<

we use this in ``pandas.core.series``. I *can* get around this, but simpler to just rename.
Ah, just saw you commit message that mentioned it as well. 
I might prefer 'dtypes' over 'typed', but not that important
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=h1) Report
> Merging [#15998](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/85a9f8c2d5218c92a042bc7fdafe619758bfe31c?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #15998      +/-   ##
==========================================
+ Coverage   91.02%   91.02%   +<.01%     
==========================================
  Files         145      145              
  Lines       50391    50395       +4     
==========================================
+ Hits        45870    45874       +4     
  Misses       4521     4521
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.79% <100%> (-0.04%)` | :arrow_down: |
| #single | `40.41% <94.2%> (+0.08%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/typed/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvY29tbW9uLnB5) | `93.27% <ø> (ø)` | |
| [pandas/core/computation/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vY29tbW9uLnB5) | `85.71% <ø> (ø)` | |
| [pandas/core/typed/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvZ2VuZXJpYy5weQ==) | `100% <ø> (ø)` | |
| [pandas/core/computation/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vX19pbml0X18ucHk=) | `90.9% <ø> (ø)` | |
| [pandas/core/typed/inference.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvaW5mZXJlbmNlLnB5) | `98.33% <ø> (ø)` | |
| [pandas/core/typed/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvYXBpLnB5) | `100% <ø> (ø)` | |
| [pandas/core/typed/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvbWlzc2luZy5weQ==) | `86.87% <ø> (ø)` | |
| [pandas/core/typed/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvY2FzdC5weQ==) | `86.89% <ø> (ø)` | |
| [pandas/indexes/multi.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2luZGV4ZXMvbXVsdGkucHk=) | `96.7% <100%> (ø)` | :arrow_up: |
| [pandas/tseries/util.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvdXRpbC5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| ... and [78 more](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15998?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/15998?src=pr&el=footer). Last update [85a9f8c...a85e487](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=h1) Report
> Merging [#15998](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/85a9f8c2d5218c92a042bc7fdafe619758bfe31c?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #15998      +/-   ##
==========================================
+ Coverage   91.02%   91.02%   +<.01%     
==========================================
  Files         145      145              
  Lines       50391    50395       +4     
==========================================
+ Hits        45870    45874       +4     
  Misses       4521     4521
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.79% <100%> (-0.04%)` | :arrow_down: |
| #single | `40.41% <94.2%> (+0.08%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/typed/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvZ2VuZXJpYy5weQ==) | `100% <ø> (ø)` | |
| [pandas/core/typed/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvY2FzdC5weQ==) | `86.89% <ø> (ø)` | |
| [pandas/core/typed/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvY29tbW9uLnB5) | `93.27% <ø> (ø)` | |
| [pandas/core/computation/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vY29tbW9uLnB5) | `85.71% <ø> (ø)` | |
| [pandas/core/computation/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vX19pbml0X18ucHk=) | `90.9% <ø> (ø)` | |
| [pandas/core/typed/inference.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvaW5mZXJlbmNlLnB5) | `98.33% <ø> (ø)` | |
| [pandas/core/typed/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvbWlzc2luZy5weQ==) | `86.87% <ø> (ø)` | |
| [pandas/core/typed/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdHlwZWQvYXBpLnB5) | `100% <ø> (ø)` | |
| [pandas/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2luZGV4ZXMvYmFzZS5weQ==) | `96.19% <100%> (ø)` | :arrow_up: |
| [pandas/core/window.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvd2luZG93LnB5) | `96.24% <100%> (ø)` | :arrow_up: |
| ... and [78 more](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15998?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/15998?src=pr&el=footer). Last update [85a9f8c...a85e487](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=h1) Report
> Merging [#15998](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/7993fc81098936a893ec0dc0d84d41cfe4eb4218?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/15998/graphs/tree.svg?src=pr&token=eZ4WkYLtcO&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #15998      +/-   ##
==========================================
- Coverage   90.99%   90.99%   -0.01%     
==========================================
  Files         154      153       -1     
  Lines       50474    50481       +7     
==========================================
+ Hits        45931    45937       +6     
- Misses       4543     4544       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.76% <100%> (-0.05%)` | :arrow_down: |
| #single | `40.44% <91.05%> (+0.08%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/dtypes/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL21pc3NpbmcucHk=) | `86.87% <ø> (ø)` | |
| [pandas/core/dtypes/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2dlbmVyaWMucHk=) | `100% <ø> (ø)` | |
| [pandas/core/dtypes/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Nhc3QucHk=) | `86.89% <ø> (ø)` | |
| [pandas/core/computation/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vY29tbW9uLnB5) | `85.71% <ø> (ø)` | |
| [pandas/core/dtypes/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbW1vbi5weQ==) | `93.27% <ø> (ø)` | |
| [pandas/compat/pickle\_compat.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9waWNrbGVfY29tcGF0LnB5) | `69.51% <ø> (ø)` | :arrow_up: |
| [pandas/core/dtypes/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2FwaS5weQ==) | `100% <ø> (ø)` | |
| [pandas/core/dtypes/inference.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2luZmVyZW5jZS5weQ==) | `98.33% <ø> (ø)` | |
| [pandas/core/sparse/scipy\_sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL3NjaXB5X3NwYXJzZS5weQ==) | `96.96% <ø> (ø)` | |
| [pandas/core/computation/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vX19pbml0X18ucHk=) | `90.9% <ø> (ø)` | |
| ... and [87 more](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/15998?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/15998?src=pr&el=footer). Last update [7993fc8...5fe80ae](https://codecov.io/gh/pandas-dev/pandas/pull/15998?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

renamed ``typed`` -> ``dtypes``, so a bit more natural now

``pandas.core.dtypes``
finally got this bad boy working. apparently ``pytest``doesn't like nested conftest.py (of course *only* when you are running using ``pytest.main()``; it works just fine for development.
Great!