WIP: DatetimeArray+TimedeltaArray
State: closed

I'll be traveling later this week, so trying to get a few things online before disappearing.

So far this just implements `take` and `concat_same_type`.  Tests are taken from an older mothballed PR, so are pretty duplicative, need to be cleaned up.

Labels:
name: Refactor
description: Internal refactoring of code
name: Datetime
description: Datetime data dtype
name: Timedelta
description: Timedelta data type
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

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

 - There are no PEP8 issues in the file [`pandas/core/arrays/__init__.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/__init__.py) !

 - In the file [`pandas/core/arrays/datetimelike.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/datetimelike.py), following                are the PEP8 issues :
> [Line 217:5](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/datetimelike.py#L217): [E265](https://duckduckgo.com/?q=pep8%20E265) block comment should start with '# '
> [Line 218:5](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/datetimelike.py#L218): [E265](https://duckduckgo.com/?q=pep8%20E265) block comment should start with '# '
> [Line 219:5](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/datetimelike.py#L219): [E265](https://duckduckgo.com/?q=pep8%20E265) block comment should start with '# '
> [Line 220:5](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/datetimelike.py#L220): [E265](https://duckduckgo.com/?q=pep8%20E265) block comment should start with '# '


 - There are no PEP8 issues in the file [`pandas/core/arrays/datetimes.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/datetimes.py) !

 - There are no PEP8 issues in the file [`pandas/core/arrays/period.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/period.py) !

 - There are no PEP8 issues in the file [`pandas/core/arrays/timedeltas.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/core/arrays/timedeltas.py) !

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

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

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

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

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

 - There are no PEP8 issues in the file [`pandas/tests/arithmetic/conftest.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/tests/arithmetic/conftest.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/test_datetimelike.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/tests/arrays/test_datetimelike.py) !

 - There are no PEP8 issues in the file [`pandas/tests/arrays/test_datetimes.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/tests/arrays/test_datetimes.py) !

 - There are no PEP8 issues in the file [`pandas/tests/dtypes/test_generic.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/tests/dtypes/test_generic.py) !

 - There are no PEP8 issues in the file [`pandas/util/testing.py`](https://github.com/jbrockmendel/pandas/blob/cd6389242cc8302fba156d26e08dd6abf3011443/pandas/util/testing.py) !



##### Comment last updated on November 11, 2018 at 17:44 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23415?src=pr&el=h1) Report
> Merging [#23415](https://codecov.io/gh/pandas-dev/pandas/pull/23415?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/3230468980be14f4a75a3b2e99946914e9d53133?src=pr&el=desc) will **decrease** coverage by `0.06%`.
> The diff coverage is `84.61%`.

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

```diff
@@            Coverage Diff             @@
##           master   #23415      +/-   ##
==========================================
- Coverage   92.24%   92.17%   -0.07%     
==========================================
  Files         161      161              
  Lines       51278    51223      -55     
==========================================
- Hits        47299    47216      -83     
- Misses       3979     4007      +28
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <84.61%> (-0.02%)` | :arrow_down: |
| #single | `42.21% <21.15%> (-0.08%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23415?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `97.49% <100%> (-0.6%)` | :arrow_down: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.09% <77.77%> (-1.34%)` | :arrow_down: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `93.43% <78.57%> (-2.48%)` | :arrow_down: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `94.02% <88.88%> (+0.24%)` | :arrow_up: |
| [pandas/io/feather\_format.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2ZlYXRoZXJfZm9ybWF0LnB5) | `77.14% <0%> (-12.61%)` | :arrow_down: |
| [pandas/io/parquet.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnF1ZXQucHk=) | `73.72% <0%> (-11.04%)` | :arrow_down: |
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `90.68% <0%> (-2.47%)` | :arrow_down: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `95.77% <0%> (-1.56%)` | :arrow_down: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `91.04% <0%> (-1.22%)` | :arrow_down: |
| ... and [77 more](https://codecov.io/gh/pandas-dev/pandas/pull/23415/diff?src=pr&el=tree-more) | |

------

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

Quick comment: IMO it is not needed to write tests for basic functioning of eg `_concat_same_type` or `take`, this is already covered by the base extension tests. 
(for `take`, there is of course some specific handling of the fill_value, which should be tested specifically for datetime-likes)
@jbrockmendel What is the status of this, or how does it related to the other PRs? Is this still something you plan to continue working on (so worth to review), or not?
This is essentially orthogonal to the other PRs ATM.  It has been in hold in part because I expect you would be -1 on implementing any parts of the EA interface without implementing all of them.  If that expectation is incorrect, then I would probably add `__repr__` and other easily-reviewed needed-eventually methods.
My expectation (from the title and original description) was that you would further expand this PR to cover the full EA interface, but that is not the plan?
> My expectation was that you would further expand this PR to cover the full EA interface, but that is not the plan?

That was more or less the plan (the "more or less" being that I would have been OK with splitting it into chunks).  Besides the trouble with actually implementing this, we've got pieces of this conversation going on in at least four threads, and this is the one I'm most comfortable with letting lie dormant.
The useful parts of this are now a strict subset of #23643.  Closing.