BUG: Load data from a CategoricalIndex for dtype comparison, closes #…
Hello,

This is an attempt to solve #16627. I admit I'm relatively new to the pandas development process, so there is likely a better way than this (should I enable the `is_dtype_equal` method on a `CategoricalIndex`?)...

But here's one way to do it. 

 - [X] closes #16627
 - [X] tests added / passed
 - [X] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``
 - [X] whatsnew entry

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

```diff
@@            Coverage Diff             @@
##           master   #16738      +/-   ##
==========================================
+ Coverage   90.93%   90.93%   +<.01%     
==========================================
  Files         161      161              
  Lines       49281    49284       +3     
==========================================
+ Hits        44814    44817       +3     
  Misses       4467     4467
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.7% <100%> (ø)` | :arrow_up: |
| #single | `40.17% <0%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16738?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/reshape/merge.py](https://codecov.io/gh/pandas-dev/pandas/pull/16738?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9tZXJnZS5weQ==) | `94.21% <100%> (+0.02%)` | :arrow_up: |

------

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

```diff
@@            Coverage Diff             @@
##           master   #16738      +/-   ##
==========================================
- Coverage   90.93%   90.93%   -0.01%     
==========================================
  Files         161      161              
  Lines       49260    49262       +2     
==========================================
+ Hits        44797    44798       +1     
- Misses       4463     4464       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.7% <100%> (-0.01%)` | :arrow_down: |
| #single | `40.18% <50%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16738?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/16738?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `98.19% <100%> (+0.01%)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/16738?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.23% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16738?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/16738?src=pr&el=footer). Last update [664348c...081c3ce](https://codecov.io/gh/pandas-dev/pandas/pull/16738?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 First, it seems It seems `git diff upstream/master --name-only -- '*.py' | flake8 --diff` doesn't work on windows command prompt the way it should. I had to just do `git diff upstream/master | flake8 --diff` to get the flake8 to work right. Is there a FAQ on that? 

I can squash these 2 commits into 1, if you like.  no need to squash

if u want to update the flake8 instructions for windows in contributing would be great (u can do in this PR), we have the mac instructions there as well  So for me, `git diff upstream/master -u -- "*.py" | flake8 --diff` seems to work on windows. A lot of bash sorcery is unavailable... 

I am not sure if this would work well with a larger diff... Thanks @thequackdaddy  @thequackdaddy : Nice catch regarding the `flake8` issue.  Quick question: what happens if you do this:

~~~
git diff upstream/master --name-only -- "*.py" | flake8 --diff
~~~

I think the issue is the quotation marks (double in this command instead of single), but I want to make sure.  I would prefer that we have one uniform command instead of two separate ones. The ``--name-only`` piece doesn't work either. It seems that on windows you can't pass multiple lines to ``flake8``. At least on my setup you can't even pass filenames to ``flake8`` in windows in the standard command line. (I've not tried with bash on windows.) Hmmm...okay, I'll need to investigate further whether we can condense these commands into one.  Your Windows command works on Windows + Linux for me as well, so I might just change the template to use that command instead. > The --name-only piece doesn't work either.

That's part of the `git` command options, so I'm not sure why that would fail. Sorry I wasn't clear. I think that there is something about using the pipe command with windows command prompt makes it so that if you run it with ``--name-only``, when that gets returned to ``flake8`` it barfs. It might be that ``flake8`` on windows is not expecting more than 1 filename or its not being pathed correctly. 

However, ``git diff master --name-only`` will show a list changed files. The problem manifests one you add on the ``| flake 8 --diff`` piece. Ah, gotcha.  Your command works on the other OS's, so I made it the command to use in #16919 .  If everything looks good to you there, I can merge my PR for that.