BUG: Fix for to_excel +/- infinity #7949

Merged
merged 1 commit into from Sep 4, 2014

Conversation

Projects
None yet
2 participants
Contributor

maxchang commented Aug 6, 2014

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

xref #6812

Contributor

jreback commented Aug 6, 2014

  • 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

@jreback jreback added Bug Excel labels Aug 6, 2014

jreback added this to the 0.15.0 milestone Aug 6, 2014

@jreback jreback commented on the diff Sep 4, 2014

pandas/src/testing.pyx
@@ -122,6 +122,10 @@ cpdef assert_almost_equal(a, b, bint check_less_precise=False):
if np.isinf(a):
assert np.isinf(b), "First object is inf, second isn't"
+ if np.isposinf(a):
@jreback

jreback Sep 4, 2014

Contributor

why did you add this?

Contributor

jreback commented Sep 4, 2014

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

@jreback jreback modified the milestone: 0.15.1, 0.15.0 Sep 4, 2014

Contributor

maxchang commented Sep 4, 2014

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.

Contributor

jreback commented Sep 4, 2014

@maxchang ok, makes sense.

pls rebase and squash and then I think good to go

@jreback jreback modified the milestone: 0.15.0, 0.15.1 Sep 4, 2014

@maxchang maxchang BUG: Fix for to_excel +/- infinity
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.
6644f8b
Contributor

maxchang commented Sep 4, 2014

@jreback Ok, should be ready now.

@jreback jreback merged commit 6644f8b into pandas-dev:master Sep 4, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
Contributor

jreback commented Sep 4, 2014

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment