standardize signature for Index reductions, implement nanmean for datetime64 dtypes
State: closed

Same basic goal as #23890, but focusing on nanops (a module I'm not all that familiar with) first, with the array methods later, instead of vice-versa.

I think the only user-facing change (i.e. need for whatsnew) is that `Series[datetime64].mean()` now works.

I need to see if there are any more tests from #23890 or #24024 that can be copied here.  

- [x] closes #24265
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Datetime
description: Datetime data dtype
name: API Design

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





















Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on December 28, 2018 at 23:37 Hours UTC
possibly closes #21583
test_nanops is a PITA in to troubleshoot.  code de-duplication at the expense of clarity may need re-thinking at some point.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24293?src=pr&el=h1) Report
> Merging [#24293](https://codecov.io/gh/pandas-dev/pandas/pull/24293?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/7b0fa8e94e22aa4a491fa574bc56f8ca791f7608?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/24293/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24293?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24293      +/-   ##
==========================================
+ Coverage   92.22%   92.22%   +<.01%     
==========================================
  Files         162      162              
  Lines       51824    51842      +18     
==========================================
+ Hits        47795    47813      +18     
  Misses       4029     4029
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.63% <100%> (ø)` | :arrow_up: |
| #single | `43% <45.71%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24293?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/nanops.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbmFub3BzLnB5) | `95.14% <100%> (+0.09%)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.29% <100%> (ø)` | :arrow_up: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `97.66% <100%> (+0.02%)` | :arrow_up: |
| [pandas/core/dtypes/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL21pc3NpbmcucHk=) | `93.18% <100%> (+0.07%)` | :arrow_up: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `97.34% <100%> (+0.01%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24293?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/24293?src=pr&el=footer). Last update [7b0fa8e...04cf1f7](https://codecov.io/gh/pandas-dev/pandas/pull/24293?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/24293?src=pr&el=h1) Report
> Merging [#24293](https://codecov.io/gh/pandas-dev/pandas/pull/24293?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/4f1c1dcc3336070b03f5a457616e6ba9e15b0030?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/24293/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24293?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24293      +/-   ##
==========================================
- Coverage   92.32%   92.31%   -0.01%     
==========================================
  Files         166      166              
  Lines       52298    52320      +22     
==========================================
+ Hits        48285    48301      +16     
- Misses       4013     4019       +6
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.73% <100%> (-0.01%)` | :arrow_down: |
| #single | `43.04% <31.03%> (-0.03%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24293?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/nanops.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbmFub3BzLnB5) | `94.9% <100%> (-0.16%)` | :arrow_down: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.59% <100%> (+0.05%)` | :arrow_up: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `97.72% <100%> (+0.02%)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.73% <100%> (+0.01%)` | :arrow_up: |
| [pandas/core/dtypes/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL21pc3NpbmcucHk=) | `93.18% <100%> (+0.07%)` | :arrow_up: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `97.34% <100%> (+0.01%)` | :arrow_up: |
| [pandas/core/dtypes/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Nhc3QucHk=) | `88.72% <0%> (-0.67%)` | :arrow_down: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24293/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `95.45% <0%> (-0.2%)` | :arrow_down: |

------

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

needs. parameterization pass
If everyone is happy with this, I can get started on a follow-up that will trim reductions off of #24024.
Updated to pass skipna in the appropriate places in Index and DatetimeIndexOpsMixin methods.  Updated a handful of tests, but I'm not confident we got thorough coverage
Travis fail is hypothesis
rebased
> as I said above you have dtype inference in 2 places for no reason.

Just pushed, collected all of that at the top of _get_values.
code looks good. if you can update the doc-strings then would be good.
I think docstring comments have been addressed; bears double-checking
thanks @jbrockmendel 

I think we need a whatsnew for this #24265, if you can add in next PR
@datapythonista @jorisvandenbossche @TomAugspurger its worth investigating if we can somehow share doc-strings with EA, Index, Series for *some* operations by templating.