-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
quantile: rename interpolation arg to method #6108
Conversation
|
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 think this is ready for review.
xarray/core/dataarray.py
Outdated
- nearest: ``i`` or ``j``, whichever is nearest. | ||
- midpoint: ``(i + j) / 2``. | ||
use when the desired quantile lies between two data points. | ||
See numpy.quantile for available methods. |
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.
Is this ok or should we list them explicitly? (The available methods depend on the numpy version which makes this a bit difficult).
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 would lean toward listing the current available methods but if not, we should make sure numpy.quantile
get's picked up as a link by intersphinx.
+1 on making this change. However, just to note, Pandas seems to still have the the |
xarray/core/dataarray.py
Outdated
interpolation: str = "linear", | ||
q: ArrayLike, | ||
dim: str | Sequence[Hashable] | None = None, | ||
method: str = "linear", |
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.
Can use Literal["linear", etc]
here instead of str
.
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 feel that's a bit over the top - can I get away without it?
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.
Agree it would be cool, definitely fine without out too! :)
The rtd failure looks unrelated. |
8. "median_unbiased" (*) | ||
9. "normal_unbiased" (*) | ||
|
||
The first three methods are discontiuous. The following discontinuous |
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.
Typo in "discontiuous"
numpy/numpy#20327 introduces some changes to
np.quantile
(and related) for the upcoming numpy release (v1.22.0). It renames theinterpolation
keyword tomethod
and offers some new interpolation methods. This PR does two thingsinterpolation
keyword tomethod
in xarray - this change is not strictly necessary but I thought better to be consistent with numpypre-commit run --all-files
whats-new.rst
(Side note in
dask.array.percentile
themethod
keyword is used differently from theinterpolation
keyword (docs). However, xarray does not use the dask function.)TODO: need to import
ArrayLike
from npcompat.