-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Series near-zero subtraction loss of precision #2760
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
Comments
I think this is expected behaviour. When you operate on the two Series, they're aligned on the index. Either |
Hey @dsm054, I really appreciate your reply. Haha. Wow, you know, I'll just think I'll get out my sharpie now to write across the top of my laptop to not post issues late at night.... After not looking away from a screen for 14 hours and a few 🍸, one can get issue trigger happy. You're right, it is expected behavior (intrinsic to pandas' beauty, in fact), and noted from the first paragraph explaining pandas data structures:
Thanks for taking the time to note this and do know that it wasn't in vain—I am smarter. Regarding myself and posting issues, a basic tenet to keep in mind: sit on it until the next morning. |
Just to test my understanding, when you slice a Series, the index is preserved. Any operations you make against another Series is align by the original Series index, not the index of the slice. Is that correct? |
Unless I am unaware of some preset precision in pandas, I've discovered a bug in what I believe to be some part of the Series subtraction operation in pandas 0.10.1, numpy 1.6.2. I haven't tested in other versions.
Data set:
A simple slice to calculate deltas:
results in:
The resultant values (i.e., values stored at
dt[1:3]
) are exactly zero and of typenumpy.float64
. These zeros and the final null value are not correct, which can be shown with conversion to a numpy array and performing the same operation:results in the expected (and correct) values:
A little digging didn't reveal that this issue had been already mentioned, but may be related to Issues #2697 and/or #2069?
The text was updated successfully, but these errors were encountered: