Fix incorrect DTI/TDI indexing; warn before dropping tzinfo
State: closed

Slight hodge-podge.  

#21333 is about `to_period` method on DatetimeIndex silently dropping timezone info.  This PR makes `DatetimeIndex.to_period` and `Timestamp.to_period` issue a warning when losing timezone info.

#20464 is entirely unrelated, notes that `pd.date_range('1970-01-01', period=2).get_loc(pd.Timedelta(0))` returns `0` instead of raising; ditto for indexing a TDI with a Timestamp.

- [x] closes #21333
- [x] closes #20464
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


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

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

```diff
@@            Coverage Diff             @@
##           master   #22549      +/-   ##
==========================================
+ Coverage   92.05%   92.05%   +<.01%     
==========================================
  Files         169      169              
  Lines       50783    50788       +5     
==========================================
+ Hits        46749    46754       +5     
  Misses       4034     4034
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.46% <100%> (ø)` | :arrow_up: |
| #single | `42.3% <37.5%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22549?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/22549/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.68% <100%> (+0.02%)` | :arrow_up: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/22549/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `91.19% <100%> (+0.02%)` | :arrow_up: |

------

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

Hello @jbrockmendel! Thanks for updating the PR.

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

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

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

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

 - There are no PEP8 issues in the file [`pandas/tests/indexes/timedeltas/test_indexing.py`](https://github.com/jbrockmendel/pandas/blob/e9c3dd45a0e8460619b54875a1138a5b2e6d1329/pandas/tests/indexes/timedeltas/test_indexing.py) !

 - There are no PEP8 issues in the file [`pandas/tests/scalar/timestamp/test_timestamp.py`](https://github.com/jbrockmendel/pandas/blob/e9c3dd45a0e8460619b54875a1138a5b2e6d1329/pandas/tests/scalar/timestamp/test_timestamp.py) !


Looks like circleCI is a hypothesis timeout
lgtm. rebase after @mroeschke CalendarDay change. ping on green.
Ping
thanks!