Repository navigation
ENH: Add np.quantile - #9213
ENH: Add np.quantile#9213eric-wieser wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Copy was only needed for the in-place divide by 100
There was a problem hiding this comment.
Error message is shared between percentile and quantile. Should it mention both, or should we somehow taylor tailor it?
There was a problem hiding this comment.
I'd taylor it. At the least, something like
raise ValueError("Quantiles must be in the interval [0.0, 1.0]")
But it is a private function, so it shouldn't error. I'd move the check and error message out into the calling code.
There was a problem hiding this comment.
Maybe an oldfashioned python assert if you want it for debugging.
There was a problem hiding this comment.
I don't think you should cheat on the documentation like that, just make the usual docstring. I don't see a need to mention percentile here, just having it in the See Also section should be enough.
There was a problem hiding this comment.
The percentile docstring is awfully long, and that risks it being fixed in one place and not the other.
I guess I could templatize it, and interpolate relevent parts for quantile and percentile?
There was a problem hiding this comment.
Just copy it with modifications, I don't think docstring length is something to worry about, but If anything, I'd document quantile and have percentile refer to it. In any case, "eaxctly the same` is not true.
|
Needs tests. There is something bad going on with Python2, but not obvious to me what. I suspect integer division or somesuch. |
|
Assuming I address the review comments, do you think this is a worthwhile addition? |
I'm not the person to ask, I don't do much statistics and haven't even used percentile. Maybe @josef-pkt might have some input. |
|
Also @rkern . |
|
statsmodels is using np.percentile quite a bit. So, for me/us quantile would be the more obvious choice than percentile. I'm not sure it's worth two functions, but I think statsmodels would eventually completely switch over to quantile. |
649400a to
90bb43c
Compare
|
All things being equal, I certainly would prefer |
|
@charris: I've updated with better error messages. I've also been a little more brutal with avoiding repetition of details in the docs. Now only |
|
Still needs that message to the mailing list, but for the record: I'm -1 on deprecating |
|
I'll write an email to the mailing list. My vote is on keeping |
|
I am all for a |
There was a problem hiding this comment.
Use something less subjective than "better". "Updated" for example.
|
Looks like the merge conflicts here are rather minor. Could we fix it and merge it in? I could then update #9211 accordingly. |
|
Conflicts solved, and on the mailing list both @charris and @josef-pkt seem to now be in favor. Perhaps wait a few more days for any more responses, and then merge? |
|
Rebased to fix conflicts and the previous rebase mistakes, but none of the other things changed. @chunweiyuan, can I recommend you rebase on this to fix the releasenote problems in your PR? As an aside, you should be able to submit a PR directly against my branch at eric-wieser/numpy, but what you did here makes more sense anyway. |
|
@eric-wieser since I made the mistake of doing all the changes in 1 commit, I think I'm going to: 1.) pull your branch again, 2.) make changes only to function_base.py without mucking with any release notes, and 3.) PR back. I might try (3) against your branch, though I'm still bewildered why I wasn't able to do that beforehand. |
|
You should just be able to cherry pick /rebase your single commit, and solve the small merge conflicts |
Updates the two docstrings to match.
DOC: Fixup percentile docstring, from review in gh-9213
|
Closing in favor of the more recent #10199, since other parts of this PR are already merged |
Breaks off from #9211.
quantileis arguably a cleaner interface thanpercentile, as it removes the need to multiply by 100