MCPcopy Index your code
hub / github.com/pydata/xarray / quantile

Method quantile

xarray/core/variable.py:1926–2064  ·  view source on GitHub ↗

Compute the qth quantile of the data along the specified dimension. Returns the qth quantiles(s) of the array elements. Parameters ---------- q : float or sequence of float Quantile to compute, which must be between 0 and 1 inclusive.

(
        self,
        q: np.typing.ArrayLike,
        dim: str | Sequence[Hashable] | None = None,
        method: QuantileMethods = "linear",
        keep_attrs: bool | None = None,
        skipna: bool | None = None,
        interpolation: QuantileMethods | None = None,
    )

Source from the content-addressed store, hash-verified

1924 return self.broadcast_equals(other, equiv=equiv)
1925
1926 def quantile(
1927 self,
1928 q: np.typing.ArrayLike,
1929 dim: str | Sequence[Hashable] | None = None,
1930 method: QuantileMethods = "linear",
1931 keep_attrs: bool | None = None,
1932 skipna: bool | None = None,
1933 interpolation: QuantileMethods | None = None,
1934 ) -> Self:
1935 """Compute the qth quantile of the data along the specified dimension.
1936
1937 Returns the qth quantiles(s) of the array elements.
1938
1939 Parameters
1940 ----------
1941 q : float or sequence of float
1942 Quantile to compute, which must be between 0 and 1
1943 inclusive.
1944 dim : str or sequence of str, optional
1945 Dimension(s) over which to apply quantile.
1946 method : str, default: "linear"
1947 This optional parameter specifies the interpolation method to use when the
1948 desired quantile lies between two data points. The options sorted by their R
1949 type as summarized in the H&F paper [1]_ are:
1950
1951 1. "inverted_cdf"
1952 2. "averaged_inverted_cdf"
1953 3. "closest_observation"
1954 4. "interpolated_inverted_cdf"
1955 5. "hazen"
1956 6. "weibull"
1957 7. "linear" (default)
1958 8. "median_unbiased"
1959 9. "normal_unbiased"
1960
1961 The first three methods are discontiuous. The following discontinuous
1962 variations of the default "linear" (7.) option are also available:
1963
1964 * "lower"
1965 * "higher"
1966 * "midpoint"
1967 * "nearest"
1968
1969 See :py:func:`numpy.quantile` or [1]_ for details. The "method" argument
1970 was previously called "interpolation", renamed in accordance with numpy
1971 version 1.22.0.
1972
1973 keep_attrs : bool, optional
1974 If True, the variable's attributes (`attrs`) will be copied from
1975 the original object to the new one. If False (default), the new
1976 object will be returned without attributes.
1977 skipna : bool, optional
1978 If True, skip missing values (as marked by NaN). By default, only
1979 skips missing values for float dtypes; other dtypes either do not
1980 have a sentinel missing value (int) or skipna=True has not been
1981 implemented (object, datetime64 or timedelta64).
1982
1983 Returns

Calls 5

_get_keep_attrsFunction · 0.90
apply_ufuncFunction · 0.90
module_availableFunction · 0.90
transposeMethod · 0.45
squeezeMethod · 0.45

Tested by 4

test_quantileMethod · 0.76
test_quantile_methodMethod · 0.76