-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: float truncation in eval with py 2 #14255
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
Current coverage is 85.25% (diff: 100%)@@ master #14255 diff @@
==========================================
Files 140 140
Lines 50568 50572 +4
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43112 43116 +4
Misses 7456 7456
Partials 0 0
|
def __unicode__(self): | ||
# in python 2 str() of float | ||
# can truncate shorter than repr() | ||
return repr(self.name) |
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.
I bet this is a similar problem when selecting from pytables, can you add a test for that?
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.
Added a test/fix for this
can you change the pytables test to add 3 values, then have the scalar select the middle one select and having it return empty doesn't prove it works, more like proves it doesn't not work :> |
tm.assert_frame_equal(expected, result) | ||
|
||
exact = 1000000000.0011 | ||
result = df.query('A == %.4f' % exact) |
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.
oh I didn't mean for this last one to be ==
, it might work but I wouldn't guarantee it (as float equality esp when you store may not be guaranteed )
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.
I know float precision is thorny generally, but shouldn't this be guaranteed with HDF5?
i don't know how equality of floats works in numexpr / HDF5 it might test well for us but fail on some platforms (just a guess) - so include if passes |
thanks! |
git diff upstream/master | flake8 --diff
Python 2 only - apparently
str()
rounds shorter thanrepr()