BUG: User-facing AssertionError with add column to SparseDataFrame
State: closed

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


Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: Sparse
description: Sparse Data Type

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

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

```diff
@@            Coverage Diff             @@
##           master   #25503      +/-   ##
==========================================
- Coverage   91.75%   91.75%   -0.01%     
==========================================
  Files         173      173              
  Lines       52955    52957       +2     
==========================================
  Hits        48589    48589              
- Misses       4366     4368       +2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.31% <50%> (-0.01%)` | :arrow_down: |
| #single | `41.72% <0%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25503?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25503/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `94.65% <50%> (-0.2%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25503/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.57% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25503?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/25503?src=pr&el=footer). Last update [011f0a6...d2be63a](https://codecov.io/gh/pandas-dev/pandas/pull/25503?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/25503?src=pr&el=h1) Report
> Merging [#25503](https://codecov.io/gh/pandas-dev/pandas/pull/25503?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/03a094869e7df0e0df0e7b7a4d8fea5d2ed0fa7d?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `50%`.

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

```diff
@@            Coverage Diff             @@
##           master   #25503      +/-   ##
==========================================
- Coverage   91.89%   91.89%   -0.01%     
==========================================
  Files         175      175              
  Lines       52491    52493       +2     
==========================================
- Hits        48238    48236       -2     
- Misses       4253     4257       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.44% <50%> (-0.01%)` | :arrow_down: |
| #single | `40.73% <0%> (-0.15%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25503?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25503/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `95.5% <50%> (-0.2%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/25503/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `75% <0%> (-12.5%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25503/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.79% <0%> (-0.12%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25503/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.72% <0%> (+0.1%)` | :arrow_up: |

------

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

Good start!  Definitely will need to add a test for this.
Hello @charlesdong1991! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:





There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-04-12 12:21:51 UTC
> Good start! Definitely will need to add a test for this.

one of the changes will be hitting this test (updated to catch error type in #25483)

https://github.com/pandas-dev/pandas/blob/b99f8bc3ce4b0d5aa71e2caf8db5e6dc4dbc42de/pandas/tests/sparse/frame/test_frame.py#L553-L555


can you merge master and resolve conflicts. ping on green.
can you merge master & add a whatsnew note for this. ping on green.
@jreback i merged the master and made the doc change, pls take a look, thanks
@jreback i just merged the master and resolved the conflict, pls take a look if you have some time. thanks!
thanks @charlesdong1991