API: DataFrame.sparse accessor
State: closed

Closes https://github.com/pandas-dev/pandas/issues/25681


Labels:
name: Sparse
description: Sparse Data Type

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

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

```diff
@@            Coverage Diff             @@
##           master   #25682      +/-   ##
==========================================
+ Coverage   91.29%   91.29%   +<.01%     
==========================================
  Files         173      173              
  Lines       52961    53013      +52     
==========================================
+ Hits        48349    48398      +49     
- Misses       4612     4615       +3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.87% <93.42%> (ø)` | :arrow_up: |
| #single | `41.72% <22.36%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25682?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25682/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `96% <100%> (+0.29%)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25682/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.79% <100%> (ø)` | :arrow_up: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/25682/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `92.19% <92.85%> (+0.01%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25682?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/25682?src=pr&el=footer). Last update [21769e9...24f48c3](https://codecov.io/gh/pandas-dev/pandas/pull/25682?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/25682?src=pr&el=h1) Report
> Merging [#25682](https://codecov.io/gh/pandas-dev/pandas/pull/25682?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/2123a96d6bc5b511ae1d1109000be7055deb2b8c?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `97.75%`.

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

```diff
@@            Coverage Diff             @@
##           master   #25682      +/-   ##
==========================================
- Coverage   91.68%   91.68%   -0.01%     
==========================================
  Files         174      174              
  Lines       50704    50747      +43     
==========================================
+ Hits        46489    46528      +39     
- Misses       4215     4219       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.19% <97.75%> (ø)` | :arrow_up: |
| #single | `41.19% <25.84%> (-0.14%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25682?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25682/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `95.63% <100%> (+0.14%)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25682/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.02% <100%> (-0.12%)` | :arrow_down: |
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/25682/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `92.7% <97.46%> (+0.39%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/25682/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |

------

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

@TomAugspurger if you can merge master
Won't have time in the near term.

I'm not sure which docstrings you were suggesting to share.

I'd prefer to have all the accessors tests in a single place so I'll push
back against the suggestion to split the SciPy ones off.

On Thu, Apr 4, 2019 at 7:56 PM Jeff Reback <notifications@github.com> wrote:

> @TomAugspurger <https://github.com/TomAugspurger> if you can merge master
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/25682#issuecomment-480113638>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHItV7eEh7t5DaqfKzxSFQ7kulfKkcks5vdp8hgaJpZM4bp_Wv>
> .
>

Ping, assuming CI passes.
Pushed a fix for column handling.

I don’t plan to spend more time on this. If it isn’t ready, I’d suggest a doc-only deprecation of sparse series and sparse DataFrame. 
@TomAugspurger this looked fine, just a couple of questions above. (and merge master); 
@TomAugspurger just a few questions
All green. I'll update https://github.com/pandas-dev/pandas/pull/26137 once this is in.
thanks @TomAugspurger