-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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: Groupby median on timedelta column with NaT returns odd value (#… #57957
Conversation
a132083
to
f9a6d3d
Compare
…andas-dev#57926) Handle NaT correctly in group_median_float64
f9a6d3d
to
44d56aa
Compare
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.
Thanks for the PR! Looking good.
…_datetimelike is true
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.
lgtm
cdef float64_t median_linear(float64_t* a, int n) noexcept nogil: | ||
cdef float64_t median_linear( | ||
float64_t* a, | ||
int n, |
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.
FYI these should be Py_ssize_t
not int
. int
is limited to 2 ** 31 - 1
on most platforms, so this would cause undefined behavior if ever called with an n
that exceeded that (probably unlikely within groupby...but still possible)
Happy to have that in a follow up PR
Thanks @JJLLWW |
@WillAyd - why the backport? I didn't think this was a regression. |
Ah OK - I thought we were doing bugfixes on that branch now. Didn't realize it was limited to regressions. Can just keep this on 3.x then |
This might be just me, but I like to keep patch versions as small as possible since bugfixes can induce new bugs and would like patch upgrade to be as safe as possible for users. But in the past, I know others have been more inclined to backport more than I prefer - cc @phofl for any thoughts. |
Agree with @rhshadrach we backported fixes for new features that were introduced in the version before but generally not much else |
Ah, I think that's where I remember a disagreement - thanks. And yea, I've come around to doing bug fixes for new features. |
…57926)
Handle NaT correctly in group_median_float64
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.