BUG: Fix Series.nlargest for integer boundary values
State: closed

- [X] closes #21426
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Also added some similar tests for float and datetimelike dtypes to ensure that the behavior is as desired.

Labels:
name: Bug
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Algos
description: Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff

Comments:
> No whatsnew entry for the time being since this was tagged as 0.23.2, and no whatsnew has been created for that release yet.

@jschendel : Not a problem.  Just wait for #21433 and rebase.
#21433 has been merged.  Feel free to rebase to add your `whatsnew`.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21432?src=pr&el=h1) Report
> Merging [#21432](https://codecov.io/gh/pandas-dev/pandas/pull/21432?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/bf1c3dc253c08e70c543ae09c146b72544e85df5?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/21432/graphs/tree.svg?token=eZ4WkYLtcO&width=650&src=pr&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/21432?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #21432      +/-   ##
==========================================
+ Coverage   91.89%    91.9%   +<.01%     
==========================================
  Files         153      153              
  Lines       49604    49606       +2     
==========================================
+ Hits        45584    45588       +4     
+ Misses       4020     4018       -2
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21432?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/algorithms.py](https://codecov.io/gh/pandas-dev/pandas/pull/21432/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWxnb3JpdGhtcy5weQ==) | `94.83% <100%> (+0.01%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/21432/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `84.81% <0%> (+0.2%)` | :arrow_up: |

------

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

Addressed review comments; copied @gfyoung's dtype fixtures where appropriate.

Did some additional cleaning of `frame/test_analytics.py` to use one of the new fixtures I created, and to use multiple instances of `parametrize` instead of jamming everything into a single one with `product`.
thanks @jschendel 
can you create an issue to use these fixtures project wide?
> can you create an issue to use these fixtures project wide?

Created #21500 for this