BUG: pd.to_datetime() throws if caching is on with Null-like arguments
- [x] closes #22305
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

The problem was in contradictory behavior between `pd.Index([pd.NaT, None]).is_unique` that returns `False` and `algorithms.unique([pd.NaT, None])` that returns `array([NaT, None], dtype=object)` equivalent to the object being unique.

We are only using `Index(arg).unique()` now.

The test written by @realead was added to verify changes.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26078?src=pr&el=h1) Report
> Merging [#26078](https://codecov.io/gh/pandas-dev/pandas/pull/26078?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/5a150694731d2ecce670cca65760c472338a04fa?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/26078/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26078?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26078      +/-   ##
==========================================
- Coverage   91.89%   91.89%   -0.01%     
==========================================
  Files         175      175              
  Lines       52509    52514       +5     
==========================================
+ Hits        48255    48256       +1     
- Misses       4254     4258       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.45% <100%> (ø)` | :arrow_up: |
| #single | `40.74% <55.55%> (-0.14%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26078?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.78% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYmFzZS5weQ==) | `97.81% <100%> (+0.03%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `75% <0%> (-12.5%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.79% <0%> (-0.12%)` | :arrow_down: |

------

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

```diff
@@            Coverage Diff             @@
##           master   #26078      +/-   ##
==========================================
+ Coverage   91.89%   91.98%   +0.08%     
==========================================
  Files         175      175              
  Lines       52509    52384     -125     
==========================================
- Hits        48255    48184      -71     
+ Misses       4254     4200      -54
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.53% <100%> (+0.08%)` | :arrow_up: |
| #single | `40.74% <0%> (-0.15%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26078?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/tools/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvZGF0ZXRpbWVzLnB5) | `84.59% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `75% <0%> (-12.5%)` | :arrow_down: |
| [pandas/util/\_doctools.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvX2RvY3Rvb2xzLnB5) | `12% <0%> (-0.88%)` | :arrow_down: |
| [pandas/core/panel.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWwucHk=) | `35.43% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/computation/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vb3BzLnB5) | `95.62% <0%> (-0.04%)` | :arrow_down: |
| [pandas/core/computation/align.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vYWxpZ24ucHk=) | `97.8% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/reshape/melt.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9tZWx0LnB5) | `97.47% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/dtypes/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbmNhdC5weQ==) | `96.56% <0%> (-0.02%)` | :arrow_down: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `83.76% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/nanops.py](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbmFub3BzLnB5) | `93.82% <0%> (-0.02%)` | :arrow_down: |
| ... and [44 more](https://codecov.io/gh/pandas-dev/pandas/pull/26078/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26078?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/26078?src=pr&el=footer). Last update [5a15069...a3c66b3](https://codecov.io/gh/pandas-dev/pandas/pull/26078?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 Hello @anmyachev! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:





There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-04-17 10:56:38 UTC thanks @anmyachev  This issue persists in pandas 1.2.4. Doesn't seem like this was ever merged to prod - are there perhaps any plans? I can confirm this issue occurs in pandas 1.2.4. However, it was not reproducible in pandas 1.3.4.
Can anyone confirm this was fixed?