-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Raise ValueError if a column index in usecols is out of bounds. … #25686
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25686 +/- ##
==========================================
+ Coverage 91.29% 91.29% +<.01%
==========================================
Files 173 173
Lines 52961 52970 +9
==========================================
+ Hits 48350 48359 +9
Misses 4611 4611
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25686 +/- ##
==========================================
+ Coverage 91.47% 91.48% +<.01%
==========================================
Files 173 173
Lines 52872 52881 +9
==========================================
+ Hits 48366 48376 +10
+ Misses 4506 4505 -1
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.24.2.rst
Outdated
@@ -18,7 +18,7 @@ including other versions of pandas. | |||
.. _whatsnew_0242.regressions: | |||
|
|||
Fixed Regressions | |||
^^^^^^^^^^^^^^^^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some git issues. Try reverting the changes to this file.
…ecols-out-of-bounds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @heckeop !
@jreback back over to you
lgtm. @heckeop can you merge master. ping on green. |
data = "a,b,c\n1,2,3\n4,5,6" | ||
parser = all_parsers | ||
|
||
with pytest.raises(ValueError, match=_msg_validate_usecols_names): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although this technically doesn't fail the regex, it appears that _msg_validate_usecols_names
is intended to be used with .format()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea good catch @simonjayhawkins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed! @jreback I'll push an update this weekend
data = "a,b,c\n1,2,3\n4,5,6" | ||
parser = all_parsers | ||
|
||
with pytest.raises(ValueError, match=_msg_validate_usecols_names): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea good catch @simonjayhawkins
can you merge master. ping on green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls merge master and update the whatsnew. ping on green.
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -123,7 +123,7 @@ Bug Fixes | |||
~~~~~~~~~ | |||
- Bug in :func:`to_datetime` which would raise an (incorrect) ``ValueError`` when called with a date far into the future and the ``format`` argument specified instead of raising ``OutOfBoundsDatetime`` (:issue:`23830`) | |||
- Bug in an error message in :meth:`DataFrame.plot`. Improved the error message if non-numerics are passed to :meth:`DataFrame.plot` (:issue:`25481`) | |||
- | |||
- Bug in ``read_csv`` which would not raise ``ValueError`` if a column index in ``usecols`` was out of bounds (:issue:`25623`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be moved to the I/O section of bug fixes
Hello @heckeop! 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-03-25 02:29:50 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc changes, ping on green.
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -182,7 +182,8 @@ Performance Improvements | |||
|
|||
Bug Fixes | |||
~~~~~~~~~ | |||
|
|||
- Bug in :func:`to_datetime` which would raise an (incorrect) ``ValueError`` when called with a date far into the future and the ``format`` argument specified instead of raising ``OutOfBoundsDatetime`` (:issue:`23830`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove these; these have already been moved
pandas/io/parsers.py
Outdated
@@ -2632,6 +2644,10 @@ def _infer_columns(self): | |||
ncols = len(line) | |||
num_original_columns = ncols | |||
|
|||
# GH25623 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well
@jreback Thoughts? |
thanks @heckeop the test is pretty clear i think. |
fixes #25623
git diff upstream/master -u -- "*.py" | flake8 --diff