BUG: Fix for to_excel +/- infinity by maxchang · Pull Request #7949 · pandas-dev/pandas (original) (raw)
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
BUG: Previously, a negative sign was being prepended for positive infinity, not for negative infinity. (GH6812)
xref #6812
- need a tests for this (write a frame with both pos/neg inf, read back and check that they match)
should fail w/o the fix and pass after - need a release note in v0.15.0.txt (bug fix section), reference this issue number
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you add this?
status of this? (did you see my comments above)?
There was an existing test (test_inf_roundtrip() in test_excel.py) that wrote/read a frame with positive and negative infinity, but it was not catching the error due to an oversight in the underlying comparison. In testing.pyx, assert_almost_equal() was only looking for infinite values, regardless of +/-. Adding the check for +/- there allows test_inf_roundtrip() to work as expected.
@maxchang ok, makes sense.
pls rebase and squash and then I think good to go
Previously, a negative sign was being prepended to positive infinite values and was absent for negative infinity. (GH6812)
TST: assert_almost_equals() checks +/- infinity
The existing test_inf_roundtrip should have caught this bug, but
the underlying assert_almost_equal was not checking that the two
given values were both positive or negative.