Backport PR #25592 on branch 0.24.x (BUG: fix usage of na_sentinel with sort=True in factorize())
Backport PR #25592: BUG: fix usage of na_sentinel with sort=True in factorize()
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25695?src=pr&el=h1) Report
> Merging [#25695](https://codecov.io/gh/pandas-dev/pandas/pull/25695?src=pr&el=desc) into [0.24.x](https://codecov.io/gh/pandas-dev/pandas/commit/c53c9d166008ace932e4c6ef635a415483c73a77?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/25695/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25695?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           0.24.x   #25695      +/-   ##
==========================================
+ Coverage   92.39%   92.39%   +<.01%     
==========================================
  Files         166      166              
  Lines       52428    52430       +2     
==========================================
+ Hits        48441    48443       +2     
  Misses       3987     3987
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.83% <100%> (ø)` | :arrow_up: |
| #single | `42.9% <75%> (ø)` | :arrow_up: |

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

------

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

```diff
@@            Coverage Diff             @@
##           0.24.x   #25695      +/-   ##
==========================================
+ Coverage   92.39%   92.39%   +<.01%     
==========================================
  Files         166      166              
  Lines       52428    52430       +2     
==========================================
+ Hits        48441    48443       +2     
  Misses       3987     3987
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.83% <100%> (ø)` | :arrow_up: |
| #single | `42.9% <75%> (ø)` | :arrow_up: |

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

------

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