-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: cut with non-nano #56101
BUG: cut with non-nano #56101
Conversation
pandas/tests/reshape/test_cut.py
Outdated
# TODO: constructing DatetimeIndex with dtype="M8[s]" without truncating | ||
# the first entry here raises in array_to_datetime. Should truncate | ||
# instead of raising? | ||
# TODO: should we truncate to 7 seconds or 8? |
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.
If these are inclusive, left bin edge and in nanos the result was 7.2, I think I would expect 7 instead of 8
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.
looking at this closer, i think it doesn't really matter bc bins[0]
is calculated roughly on min(data) - .001 * (max(data) - min(data))
. that .001 * [...]
adjustment looks intended to make sure that the bottom bin is a strict lower bound. Exactly how strict doesn't seem to matter. In this test case, max(data) - min(data) is a 2-day Timedelta, and when that Timedelta has second unit, multiplying it by .001 truncated to Timedelta(minutes=2, seconds=52)
, truncating the .8 seconds.
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.
Ah I forgot about the 0.001 offset applied to the edges (though it seem code-smelly). The current truncation result should be OK then
Thanks @jbrockmendel |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.sits on top of #56099