BUG-16807-1 SparseFrame fills with default_fill_value if data is None
State: closed

- [ ] closes #16807
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Previously, the constructor for SparseFrame would default to `np.nan` if the data parameter was `None`, even if a `default_fill_value` is specified. This PR fixes this.

Labels:
name: Bug
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Sparse
description: Sparse Data Type

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

```diff
@@            Coverage Diff             @@
##           master   #24842      +/-   ##
==========================================
+ Coverage   92.39%   92.39%   +<.01%     
==========================================
  Files         166      166              
  Lines       52378    52378              
==========================================
+ Hits        48393    48394       +1     
+ Misses       3985     3984       -1
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24842?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `94.84% <100%> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88.13% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24842?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/24842?src=pr&el=footer). Last update [f4458c1...4467730](https://codecov.io/gh/pandas-dev/pandas/pull/24842?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/24842?src=pr&el=h1) Report
> Merging [#24842](https://codecov.io/gh/pandas-dev/pandas/pull/24842?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1490d0c790ba974b2e85c3c46ff721aee679d54a?src=pr&el=desc) will **increase** coverage by `50.02%`.
> The diff coverage is `100%`.

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

```diff
@@             Coverage Diff             @@
##           master   #24842       +/-   ##
===========================================
+ Coverage   41.73%   91.75%   +50.02%     
===========================================
  Files         173      173               
  Lines       52923    52960       +37     
===========================================
+ Hits        22085    48596    +26511     
+ Misses      30838     4364    -26474
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.33% <100%> (?)` | |
| #single | `41.71% <0%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24842?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `95.7% <100%> (+68.24%)` | :arrow_up: |
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `90.54% <0%> (+0.3%)` | :arrow_up: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `90.11% <0%> (+0.86%)` | :arrow_up: |
| [pandas/util/\_test\_decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvX3Rlc3RfZGVjb3JhdG9ycy5weQ==) | `90.54% <0%> (+4.05%)` | :arrow_up: |
| [pandas/compat/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9fX2luaXRfXy5weQ==) | `58.03% <0%> (+8.23%)` | :arrow_up: |
| [pandas/core/config\_init.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29uZmlnX2luaXQucHk=) | `99.24% <0%> (+9.84%)` | :arrow_up: |
| [pandas/io/formats/terminal.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvdGVybWluYWwucHk=) | `32.53% <0%> (+10.84%)` | :arrow_up: |
| [pandas/io/formats/console.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvY29uc29sZS5weQ==) | `86.27% <0%> (+13.72%)` | :arrow_up: |
| [pandas/core/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXBpLnB5) | `100% <0%> (+13.79%)` | :arrow_up: |
| [pandas/compat/numpy/\_\_init\_\_.py](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree#diff-cGFuZGFzL2NvbXBhdC9udW1weS9fX2luaXRfXy5weQ==) | `93.33% <0%> (+14.02%)` | :arrow_up: |
| ... and [131 more](https://codecov.io/gh/pandas-dev/pandas/pull/24842/diff?src=pr&el=tree-more) | |

------

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

there are a number of issues in the OP, are these all tested?
@jreback I added tests for issues 2-3. The last one I think isn't a storage issue, but a formatting one. Sometimes, integers in sparse data structures can be printed as floats if there are `NaN` values involved. Can it be fixed in this PR or should it be considered a separate issue?
```
>>> a=pd.SparseDataFrame(coo_matrix(np.arange(2).reshape(2,1),dtype=np.int64))
>>> a
     0
0  NaN
1  1.0
>>> a[0][1]
1
```
lgtm. ping on green.
@jreback green
Thanks @JustinZhengBC !