implement TimedeltaArray asm8, to_timedelta64
State: closed

For compat with Timedelta scalar

- [x] closes #22632
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Timedelta
description: Timedelta data type

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

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

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


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23205?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@4cac923`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff            @@
##             master   #23205   +/-   ##
=========================================
  Coverage          ?   92.19%           
=========================================
  Files             ?      169           
  Lines             ?    50958           
  Branches          ?        0           
=========================================
  Hits              ?    46979           
  Misses            ?     3979           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <100%> (?)` | |
| #single | `42.27% <50%> (?)` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23205?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23205/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `94.08% <100%> (ø)` | |

------

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

Updated to implement DatetimeArray.asm8, DatetimeArray.to_datetime64
Thinking about this a bit more: I am -1 on adding duplicate attributes/methods just for sake of consistency with our scalar type `Timestamp`/`Timedelta`. We already have a bloated API.

Also for DatetimeIndex/TimedeltaIndex, it is not really clear to me what this is targeted use case is, as it just returns a copy of itself? (except that it returns an array instead of index? Which I also don't find clear from the name)
> Thinking about this a bit more: I am -1 on adding duplicate attributes/methods just for sake of consistency with our scalar type Timestamp/Timedelta. We already have a bloated API.

Would you advocate removing one/both of the attributes from the Timedelta/Timestamp scalars?
lgtm. waiting for CI to merge.
thanks!
Sorry, Jeff, but I clearly objected this PR. Can you then at least discuss it before merging? 
So I reverted the PR.
@jorisvandenbossche if u object then your need to actually put in a review request to do so