Fixes np.unique on SparseArray
State: closed

- [x] closes #19595 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Bug
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Sparse
description: Sparse Data Type

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19651?src=pr&el=h1) Report
> Merging [#19651](https://codecov.io/gh/pandas-dev/pandas/pull/19651?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d9551c8ee2a09ccc4c39d2b661f199334162edb6?src=pr&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `83.33%`.

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

```diff
@@            Coverage Diff             @@
##           master   #19651      +/-   ##
==========================================
+ Coverage   91.57%   91.59%   +0.01%     
==========================================
  Files         150      150              
  Lines       48817    48811       -6     
==========================================
+ Hits        44704    44707       +3     
+ Misses       4113     4104       -9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.96% <83.33%> (+0.01%)` | :arrow_up: |
| #single | `41.73% <66.66%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19651?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `92.2% <ø> (ø)` | :arrow_up: |
| [pandas/core/algorithms.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWxnb3JpdGhtcy5weQ==) | `94.01% <83.33%> (-0.13%)` | :arrow_down: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `95.22% <0%> (-1.62%)` | :arrow_down: |
| [pandas/io/sas/sas\_xport.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfeHBvcnQucHk=) | `90.27% <0%> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.17% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/sparse/array.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2FycmF5LnB5) | `91.4% <0%> (+0.02%)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.61% <0%> (+0.04%)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `83.85% <0%> (+0.2%)` | :arrow_up: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.56% <0%> (+0.24%)` | :arrow_up: |
| ... and [5 more](https://codecov.io/gh/pandas-dev/pandas/pull/19651/diff?src=pr&el=tree-more) | |

------

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

Hello @hexgnu! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on February 13, 2018 at 04:44 Hours UTC
can you rebase / update
@jreback : Based on this discussion [here](https://github.com/pandas-dev/pandas/pull/19651#pullrequestreview-96465651), doesn't this PR require a more substantial overhaul to properly anticipate the EA work from @TomAugspurger ?  Or is your suggestion [here](https://github.com/pandas-dev/pandas/pull/19651#discussion_r168148062) an acceptable patch?
Let's hold on this for a bit. I'm making SparseArray an ExtensionArray.
Hey everybody here. Let me know what you want me to do. We can close this and I can reopen new work when the `ExtensionArray` stuff lands or whatever. Just lemme know! :smile:
Superseded by #23186 and #22325