Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: User-facing AssertionError with add column to SparseDataFrame #25503

Merged
merged 4 commits into from
Apr 12, 2019

Conversation

charlesdong1991
Copy link
Member

@codecov
Copy link

codecov bot commented Mar 1, 2019

Codecov Report

Merging #25503 into master will decrease coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@            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%) ⬇️
#single 41.72% <0%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/sparse/frame.py 94.65% <50%> (-0.2%) ⬇️
pandas/util/testing.py 87.57% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 011f0a6...d2be63a. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 1, 2019

Codecov Report

Merging #25503 into master will decrease coverage by <.01%.
The diff coverage is 50%.

Impacted file tree graph

@@            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%) ⬇️
#single 40.73% <0%> (-0.15%) ⬇️
Impacted Files Coverage Δ
pandas/core/sparse/frame.py 95.5% <50%> (-0.2%) ⬇️
pandas/io/gbq.py 75% <0%> (-12.5%) ⬇️
pandas/core/frame.py 96.79% <0%> (-0.12%) ⬇️
pandas/util/testing.py 90.72% <0%> (+0.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03a0948...7562481. Read the comment docs.

@gfyoung gfyoung added Error Reporting Incorrect or improved errors from pandas Sparse Sparse Data Type labels Mar 2, 2019
@gfyoung
Copy link
Member

gfyoung commented Mar 2, 2019

Good start! Definitely will need to add a test for this.

@pep8speaks
Copy link

pep8speaks commented Mar 2, 2019

Hello @charlesdong1991! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

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

Comment last updated at 2019-04-12 12:21:51 UTC

@simonjayhawkins
Copy link
Member

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)

# insert ndarray wrong size
pytest.raises(Exception, frame.__setitem__, 'foo',
np.random.randn(N - 1))

msg = 'Length of values does not match length of index'
with pytest.raises(ValueError, match=msg):
sp['foo'] = np.random.randn(N-1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may not need an additional test (#25503 (comment))

the code sample in #25484 replicates the setup of the existing test. so maybe able to alter existing test to hit both changes you've made to pandas\core\sparse\frame.py in _sanitize_column

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, i see! thanks! @simonjayhawkins

@jreback jreback added this to the 0.25.0 milestone Mar 3, 2019
@jreback
Copy link
Contributor

jreback commented Mar 3, 2019

can you merge master and resolve conflicts. ping on green.

@jreback
Copy link
Contributor

jreback commented Mar 26, 2019

can you merge master & add a whatsnew note for this. ping on green.

@charlesdong1991 charlesdong1991 force-pushed the issue_25484 branch 2 times, most recently from 6b5f1d7 to adf847a Compare March 26, 2019 21:43
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc-change, otherwise lgtm. pls merge master. ping on green.

@@ -227,7 +227,7 @@ Performance Improvements

Bug Fixes
~~~~~~~~~

- Bug in `SparseDataFrame` when adding a column in which the length of values does not match length of index, ``AssertionError`` is raised instead of raising ``ValueError`` (:issue:`25484`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make a Sparse sub-section and move this there

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, sparse section is already there, moved! thanks @jreback

@charlesdong1991
Copy link
Member Author

@jreback i merged the master and made the doc change, pls take a look, thanks

@charlesdong1991
Copy link
Member Author

@jreback i just merged the master and resolved the conflict, pls take a look if you have some time. thanks!

@jreback jreback merged commit 835d6f0 into pandas-dev:master Apr 12, 2019
@jreback
Copy link
Contributor

jreback commented Apr 12, 2019

thanks @charlesdong1991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: User-facing AssertionError with add column to SparseDataFrame
5 participants