BUG: millis res on parsed DatetimeIndex slice
State: closed

Added support for millis resolution on a parsed DatetimeIndex slice.

There was no elif statement for when _parsed_string_to_bounds(self,
reso, parsed) was given reso == 'millisecond'

- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`


Labels:
name: Bug
name: Datetime
description: Datetime data dtype
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: DataFrame
description: DataFrame data structure

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

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


# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23010?src=pr&el=h1) Report
> Merging [#23010](https://codecov.io/gh/pandas-dev/pandas/pull/23010?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d523d9fe056d88c0a80a016123eca0f3ae734ae1?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `33.33%`.

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

```diff
@@            Coverage Diff             @@
##           master   #23010      +/-   ##
==========================================
- Coverage   92.19%   92.19%   -0.01%     
==========================================
  Files         169      169              
  Lines       50835    50838       +3     
==========================================
+ Hits        46868    46869       +1     
- Misses       3967     3969       +2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <33.33%> (-0.01%)` | :arrow_down: |
| #single | `42.35% <0%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23010?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23010/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.53% <33.33%> (-0.25%)` | :arrow_down: |

------

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

is this fixing an issue? this would need tests, I am not sure what doesn't work now.
Sorry for the lack of good explanation earlier. I couldn't find any existing bug in the issues that listed this problem. Basically there exists support for slicing data with a DatetimeIndex using strings for the range in core/indexes/datetimes.py (line 1263):
```
_, parsed, reso = parsing.parse_time_string(label, freq)
lower, upper = self._parsed_string_to_bounds(reso, parsed)
```
_libs/tslibs/parsing.pyx returns a resolution of milliseconds when `microsecond % 1000 == 0` (line 334)
_parsed_string_to_bounds() has if/elif's on the resolution argument for year, month, ... second, microsecond, but doesn't have one for millisecond.

I found this when I was working with data that had a precision of tenths of milliseconds (hundreds of microseconds). If you pass in a string bound with, e.g. .9871 for the fraction of the second, it slices as expected since `987100 % 1000 = 100 != 0`, so resolution is "microseconds". But if you pass in a string bound with .9870, the parsed resolution is determined to be milliseconds and _parsed_string_to_bounds() will raise a KeyError.

With regards to the tests: I'm not familiar yet with pytest / numpy.testing, but I can take a crack at writing the tests to cover this case.
closing as stale. if you'd like to continue, pls ping.