Add more specific error message when user passes incorrect matrix format to from_coo
State: closed

- [x] closes #26554
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] 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/26584?src=pr&el=h1) Report
> Merging [#26584](https://codecov.io/gh/pandas-dev/pandas/pull/26584?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/4c54dd298692783f417cbaa57d5fc1c0dc1f7c72?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #26584      +/-   ##
==========================================
- Coverage   91.84%   91.83%   -0.01%     
==========================================
  Files         174      174              
  Lines       50644    50647       +3     
==========================================
- Hits        46516    46514       -2     
- Misses       4128     4133       +5
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.37% <100%> (ø)` | :arrow_up: |
| #single | `41.69% <0%> (-0.11%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26584?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/26584/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3NwYXJzZS5weQ==) | `93.09% <100%> (+0.02%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26584/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26584/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97% <0%> (-0.12%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26584/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.81% <0%> (-0.11%)` | :arrow_down: |

------

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

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

```diff
@@            Coverage Diff             @@
##           master   #26584      +/-   ##
==========================================
- Coverage   91.86%   91.85%   -0.01%     
==========================================
  Files         174      174              
  Lines       50722    50725       +3     
==========================================
- Hits        46594    46593       -1     
- Misses       4128     4132       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.39% <100%> (ø)` | :arrow_up: |
| #single | `41.79% <0%> (-0.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26584?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/scipy\_sparse.py](https://codecov.io/gh/pandas-dev/pandas/pull/26584/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL3NjaXB5X3NwYXJzZS5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26584/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26584/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97% <0%> (-0.12%)` | :arrow_down: |

------

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

Hello @fhoang7! 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-06-02 15:07:35 UTC
@TomAugspurger @jreback: Changes made! Please review when you get the chance. Thanks!
@jreback: Thanks for the feedback! Changes are pushed. 
Done! @jreback 
@simonjayhawkins: Made requested changes. Thanks for your feedback!
@simonjayhawkins: Pushed suggested changes. 
lgtm. not sure if you saw the comments on the error mesage check and the test name. if you can address those i think we're done
@simonjayhawkins: Yup latest commit reflect those changes. Only thing is not sure why some checks are fixing so I only changed comments/test name. Looks like similar errors in the past builds before me. 

> Only thing is not sure why some checks are fixing so I only changed comments/test name. Looks like similar errors in the past builds before me.

failing CI is not related to your changes

> Yup latest commit reflect those changes

please address https://github.com/pandas-dev/pandas/pull/26584#discussion_r289621003 and https://github.com/pandas-dev/pandas/pull/26584#discussion_r289621024






@simonjayhawkins: Thanks for your patience and input. Addressed those comments and double checked over your previous comments as well to make sure I resolved them. 
@simonjayhawkins: Thanks for the headsup. Merged/pushed up. 
thanks @fhoang7