REF: Remove DatetimelikeArrayMixin._shallow_copy
State: closed

Broken off of #23426.

Labels:
name: Refactor
description: Internal refactoring of code
name: Datetime
description: Datetime data dtype
name: Clean

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

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

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

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

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


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23430?src=pr&el=h1) Report
> Merging [#23430](https://codecov.io/gh/pandas-dev/pandas/pull/23430?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/de39bfc5e5c6483cb2669773fa10ddc2e32ca111?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/23430/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/23430?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #23430      +/-   ##
==========================================
- Coverage   92.21%   92.21%   -0.01%     
==========================================
  Files         161      161              
  Lines       51173    51168       -5     
==========================================
- Hits        47190    47185       -5     
  Misses       3983     3983
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.65% <100%> (-0.01%)` | :arrow_down: |
| #single | `42.24% <44.44%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23430?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23430/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `96.05% <100%> (-0.07%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23430/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.45% <100%> (+0.01%)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23430/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.9% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23430/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `98.01% <100%> (-0.01%)` | :arrow_down: |

------

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

Looks fine to me.  A couple of points:

* Any performance impact with this refactor?
* For the less initiated, why don't we want to use `_shallow_copy` ?
> Any performance impact with this refactor?

If anything, it removes a level of function-call overhead.  Should not make a measurable impact.

> For the less initiated, why don't we want to use `_shallow_copy` ?

_shallow_copy was implemented in these EA mixin classes to make them play nicely when inherited by their respective Index subclasses.  We are moving away from having these get mixed in, and do not need _shallow_copy in the standalone EA subclasses.
thanks