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 }})

@maxchang

BUG: Previously, a negative sign was being prepended for positive infinity, not for negative infinity. (GH6812)

xref #6812

@jreback

jreback

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?

@jreback

status of this? (did you see my comments above)?

@maxchang

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.

@jreback

@maxchang ok, makes sense.

pls rebase and squash and then I think good to go

@maxchang

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.

@maxchang

@jreback

Labels

2 participants

@maxchang @jreback