Change UInt64Index._na_value from 0 to np.nan
State: closed

Prerequisite for #18300

- [X] closes #18398
- [X] closes #18400
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Summary:
- Changed `UInt64Index._na_value` from 0 to `np.nan`

- Added a `dtype` parameter to `_try_convert_to_int_index` to skip the initial attempt to coerce to `Int64Index` in cases where we really want `UInt64Index` (fix for #18400).

- Moved `test_where` and `test_where_array_like` from `TestInt64Index` to the `NumericInt` base class for more generic coverage, and forced it to check that things get coerced to `Float64Index`.  The way it was originally written raised a ValueError due to the 0 -> `np.nan` change.

Labels:
name: Bug
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

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

```diff
@@            Coverage Diff             @@
##           master   #18401      +/-   ##
==========================================
- Coverage   91.36%   91.34%   -0.02%     
==========================================
  Files         164      164              
  Lines       49730    49730              
==========================================
- Hits        45435    45426       -9     
- Misses       4295     4304       +9
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.26% <ø> (-0.02%)` | :arrow_down: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.43% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?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/18401?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/18401?src=pr&el=footer). Last update [509e03c...ea978b0](https://codecov.io/gh/pandas-dev/pandas/pull/18401?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/18401?src=pr&el=h1) Report
> Merging [#18401](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e6eac0b308af9869ee123caa8c256bd8a7cc126b?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #18401      +/-   ##
==========================================
- Coverage   91.35%   91.31%   -0.05%     
==========================================
  Files         163      163              
  Lines       49695    49695              
==========================================
- Hits        45401    45380      -21     
- Misses       4294     4315      +21
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.11% <100%> (-0.03%)` | :arrow_down: |
| #single | `39.66% <100%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.26% <ø> (-0.02%)` | :arrow_down: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.43% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.44% <0%> (-1.82%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18401?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/18401?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/18401?src=pr&el=footer). Last update [e6eac0b...0852ecb](https://codecov.io/gh/pandas-dev/pandas/pull/18401?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Regarding the `test_where` and `test_where_arraylike` tests:  having both seemed redundant, as there was a bit of overlap, so I combined them into a single test.  Some notes:
- replaced `notna` with a list of `True`, since that's all that `notna` returned, so calling `notna` seemed unnecessarily convoluted.
- Moved the tests from `NumericInt` to `Numeric` since the new version of the test also passed for `RangeIndex`.  Deleted the `RangeIndex` specific version of the tests.
- Went through and made similar changes to other `test_where` and `test_where_arraylike` tests that were essentially doing the same thing.
can you rebase. ready to go?
@jreback : this should be ready to merge once green, assuming that the whatsnew change I made to address the comment by @jorisvandenbossche is acceptable.
thanks @jschendel very nice!