[ENH] nargsort handles EA with its _values_for_argsort
State: closed

-  closes #25439
-  1 test added and 1 test deleted
-  passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
-  whatsnew entry

Presently, `nargsort` can handle EA too. Because `np.asanyarray` turns EA into `np.ndarray`.
https://github.com/pandas-dev/pandas/blob/430f0fd04646a0ab44ccbfbad706dfe22e9fabfe/pandas/core/sorting.py#L264
In this PR, `nargsort` use `EA._values_for_argsort` instead to avoid the `np.ndarray` conversion.

Labels:
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

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

```diff
@@            Coverage Diff             @@
##           master   #26854      +/-   ##
==========================================
+ Coverage   91.98%   91.99%   +<.01%     
==========================================
  Files         180      180              
  Lines       50772    50774       +2     
==========================================
+ Hits        46704    46708       +4     
+ Misses       4068     4066       -2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.63% <100%> (+0.05%)` | :arrow_up: |
| #single | `41.83% <100%> (-0.08%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26854?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sorting.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc29ydGluZy5weQ==) | `98.35% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `88.88% <0%> (-11.12%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.89% <0%> (-0.12%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `94.2% <0%> (ø)` | :arrow_up: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `90.3% <0%> (ø)` | :arrow_up: |
| [pandas/core/dtypes/cast.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2Nhc3QucHk=) | `90.72% <0%> (+0.16%)` | :arrow_up: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `94.19% <0%> (+0.46%)` | :arrow_up: |
| [pandas/core/dtypes/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26854/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL21pc3NpbmcucHk=) | `93.93% <0%> (+0.6%)` | :arrow_up: |

------

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

Only test_api is failed. But this test hasn't called `nargsort`. 
The test error is that three more objects are found i.e., `'missing_dependencies', 'dependency', 'hard_dependencies'`.
But they are already deleted in 
https://github.com/pandas-dev/pandas/blob/ea06f8d1157601b5fdb48598e27b02149828fba0/pandas/__init__.py#L17 
Do you have any idea?
I had another PR failing with the same thing @makbigc. I haven't been able to reproduce it yet.
Thanks @makbigc!