API: change datetimelike Index to raise IndexError instead ValueError
State: closed

I noticed this in the plotting PR that DatetimeIndex et al behave a bit strange on an invalid index:

```
In [41]: pd.Index([1, 2, 3])['no_int']
...
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

In [42]: pd.DatetimeIndex([1, 2, 3])['no_int']
...
ValueError: 
```

I think this should be consistent IndexError ?

Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: API Design

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=h1) Report
> Merging [#18386](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1647a724ae5c9038cdd3cf4ebbf2273d1b6ab109?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #18386      +/-   ##
==========================================
- Coverage   91.36%   91.34%   -0.02%     
==========================================
  Files         164      164              
  Lines       49718    49718              
==========================================
- Hits        45426    45417       -9     
- Misses       4292     4301       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.14% <100%> (ø)` | :arrow_up: |
| #single | `39.61% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.11% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18386?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/18386?src=pr&el=footer). Last update [1647a72...3bf0378](https://codecov.io/gh/pandas-dev/pandas/pull/18386?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/18386?src=pr&el=h1) Report
> Merging [#18386](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/a47ad560d5ff030bb67b51feaf03d7c4b6d3e55b?src=pr&el=desc) will **increase** coverage by `0.08%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #18386      +/-   ##
==========================================
+ Coverage   91.32%   91.41%   +0.08%     
==========================================
  Files         164      157       -7     
  Lines       49802    51378    +1576     
==========================================
+ Hits        45484    46965    +1481     
- Misses       4318     4413      +95
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.27% <100%> (+0.16%)` | :arrow_up: |
| #single | `40.57% <0%> (-0.31%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18386?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `96.91% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `81.8% <0%> (-18.2%)` | :arrow_down: |
| [pandas/io/json/json.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vanNvbi5weQ==) | `91.75% <0%> (-8.25%)` | :arrow_down: |
| [pandas/io/formats/style.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvc3R5bGUucHk=) | `96.21% <0%> (-3.79%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.81% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.61% <0%> (-0.1%)` | :arrow_down: |
| [pandas/tests/io/json/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL3Rlc3RzL2lvL2pzb24vX19pbml0X18ucHk=) | | |
| [pandas/tests/util/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL3Rlc3RzL3V0aWwvX19pbml0X18ucHk=) | | |
| [pandas/tests/io/msgpack/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree#diff-cGFuZGFzL3Rlc3RzL2lvL21zZ3BhY2svX19pbml0X18ucHk=) | | |
| ... and [6 more](https://codecov.io/gh/pandas-dev/pandas/pull/18386/diff?src=pr&el=tree-more) | |

------

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

thanks @jorisvandenbossche