-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix using "inf"/"-inf" in na_values for csv with int index column #22169
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
Hello @Templarrr! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on August 09, 2018 at 08:44 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #22169 +/- ##
==========================================
- Coverage 92.07% 92.07% -0.01%
==========================================
Files 169 169
Lines 50684 50683 -1
==========================================
- Hits 46668 46666 -2
- Misses 4016 4017 +1
Continue to review full report at Codecov.
|
I believe this closes #17128 can you confirm and update the whatsnew to reflect |
doc/source/whatsnew/v0.23.4.txt
Outdated
@@ -41,7 +41,7 @@ Bug Fixes | |||
|
|||
**Indexing** | |||
|
|||
- | |||
- Fix OverflowError when trying to use 'inf' as na_value with int index column |
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.
add the issue number here, use double-backticks around OverflowError. use double backticks on na_value; spell out int -> integer.
pandas/tests/io/parser/na_values.py
Outdated
@@ -369,3 +369,13 @@ def test_no_na_filter_on_index(self): | |||
expected = DataFrame({"a": [1, 4], "c": [3, 6]}, | |||
index=Index([np.nan, 5.0], name="b")) | |||
tm.assert_frame_equal(out, expected) | |||
|
|||
def test_inf_na_values_with_int_index(self): | |||
data = "idx,col1,col2\n1,3,4\n2,inf,-inf" |
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.
add the issue number here as a comment
Oh, wow, it's actually my colleague :) Thanks for the review, it's already late In my timezone, but I'll update the PR tomorrow! |
# Conflicts: # doc/source/whatsnew/v0.23.4.txt
@jreback I've confirmed that this solves the error that @YS-L reported in #17128 and addressed your PR review comments. Can you look again? Also yesterday the 0.23.4 changelog got updated with today's date, but I don't see on pypi newer pandas version released yet, so I'm not entirely sure - will my bugfix be a part of 0.23.4 or should I move the comment to 0.24.0 changelog? |
The failure in travis is some kind of network glitch, unrelated to these changes :( |
@jreback I see 0.23.4 was released, so this fix obviously didn't make it :) I've moved the changelog line to 0.24.0 |
@jreback I see you've moved the label to 0.23.5, didn't know there was 0.23.5 planned :) |
yeah we might do a 0.23.5. if you want to push a 0.23.5 whats (empty) pls do , but a new PR pls. |
doc/source/whatsnew/v0.24.0.txt
Outdated
@@ -607,6 +607,7 @@ Indexing | |||
- Fixed ``DataFrame[np.nan]`` when columns are non-unique (:issue:`21428`) | |||
- Bug when indexing :class:`DatetimeIndex` with nanosecond resolution dates and timezones (:issue:`11679`) | |||
- Bug where indexing with a Numpy array containing negative values would mutate the indexer (:issue:`21867`) | |||
- Fix ``OverflowError`` when trying to use 'inf' as ``na_value`` with integer index column (:issue:`17128`) |
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.
can you move to 0.23.5 (rebase on master to see the whatsnew)
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.
will do in few minutes
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.
@jreback done.
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.
ping on green.
@@ -40,3 +40,7 @@ Bug Fixes | |||
|
|||
- | |||
- | |||
|
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.
can you put this in the IO section, and referencde :func:read_csv
here
thanks @Templarrr |
…with int index column
You're welcome! Always glad to help :) |
…with int index column (#22259)
git diff upstream/master -u -- "*.py" | flake8 --diff
The issue happens when you try to use 'inf' or '-inf' as part of na_values in read_csv.
Code snippet to reproduce:
Without fix:
With fix (as expected):