CLN: reorg pandas.tseries
State: closed

xref #13634 

Labels:
name: Datetime
description: Datetime data dtype
name: Timedelta
description: Timedelta data type
name: Period
description: Period data type
name: Clean

Comments:
this finishes the api cleanup and moves everything but:

- ``freqencies``, ``holidays``, ``offsets``
- ``util``, and ``plotting`` (which are deprecated)

from ``pandas.tseries``.

all of the indexes code is now actually in ``pandas.core.indexes`` (tests were moved previously).


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=h1) Report
> Merging [#16040](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d16cce89521c84fcb9c7b7bb2e95629a6fe7acb7?src=pr&el=desc) will **increase** coverage by `0.02%`.
> The diff coverage is `99.34%`.

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

```diff
@@            Coverage Diff             @@
##           master   #16040      +/-   ##
==========================================
+ Coverage   90.76%   90.79%   +0.02%     
==========================================
  Files         155      156       +1     
  Lines       50484    50489       +5     
==========================================
+ Hits        45824    45839      +15     
+ Misses       4660     4650      -10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.55% <99.34%> (+0.02%)` | :arrow_up: |
| #single | `40.42% <47.71%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/tseries/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvYXBpLnB5) | `100% <ø> (ø)` | :arrow_up: |
| [pandas/core/tools/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvdGltZWRlbHRhcy5weQ==) | `98.33% <ø> (ø)` | |
| [pandas/compat/pickle\_compat.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9waWNrbGVfY29tcGF0LnB5) | `69.51% <ø> (ø)` | :arrow_up: |
| [pandas/core/datetools.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZGF0ZXRvb2xzLnB5) | `86.84% <100%> (ø)` | :arrow_up: |
| [pandas/plotting/\_timeseries.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL190aW1lc2VyaWVzLnB5) | `61.78% <100%> (ø)` | :arrow_up: |
| [pandas/core/tools/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvbnVtZXJpYy5weQ==) | `100% <100%> (ø)` | |
| [pandas/core/indexes/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9hcGkucHk=) | `98.75% <100%> (+0.06%)` | :arrow_up: |
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `94.45% <100%> (ø)` | |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `65.35% <100%> (+1.81%)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.19% <100%> (ø)` | :arrow_up: |
| ... and [24 more](https://codecov.io/gh/pandas-dev/pandas/pull/16040?src=pr&el=tree-more) | |

------

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

> We also need to think of something regarding the API docs. Currently that uses pandas.tseries.resample (eg http://pandas.pydata.org/pandas-docs/stable/generated/pandas.tseries.resample.Resampler.aggregate.html)

this just changes to ``pandas.core.resample`` so I don't see a problem.


Yes, but that means that *all* our online pages change url
You created here the `core.tools` module, which seems like a good idea, but then it may make sense to also put `to_numeric` there for consistency?
> You created here the core.tools module, which seems like a good idea, but then it may make sense to also put to_numeric there for consistency?

yeah was debating this. ok will move it.

> Yes, but that means that all our online pages change url

and? *lots* of thinks moved.
> and? lots of thinks moved.

yes, but up to now (I mean the reorg the last days), no 'public' things. And `Resampler` is not really public, apart from that it is used in the docs.
can we do a re-direct?


> can we do a re-direct?

yes, that is certainly possible. 

My concern is only that the urls currently depend a bit on the 'implementation details' in `core` (as one of the reasons of this reorg and the more explicit saying that `core` is private, is to be able to refactor internally). So just wondering whether it would make sense to expose eg GroupBy, Rolling, Resampler in eg `pandas.core` directly, not as a public API, as no user should directly use those objects, but to have a stable doc url independent of where or how in core it is implemented.

Although chance is high that the `pandas.core.groupby.GroupBy`, `pandas.core.window.Rolling`, `pandas.core.resample.Resampler` paths will not directly be changed again, so maybe not that important.
could u do some kind ornate shim for the actual links?

maybe in conf.py make a namespace like

pandas.doclinks or something then just assign the classes there ?
I am not sure something like that would work. As sphinx has to actually import it to get the docstring (I think, not sure how it works under the hood)