snowflake.snowpark.modin.plugin.extensions.resample_overrides.Resampler.quantile¶

Resampler.quantile(q: Union[float, ExtensionArray, ndarray, Index, Series] = 0.5, **kwargs: Any) → Union[DataFrame, Series][source]¶

Return value at the given quantile.

Parameters:

q (float or array-like, default 0.5 (50% quantile)) –

Returns:

Quantile of values within each group.

Return type:

Series or DataFrame

See also

Series.quantile

Return a series, where the index is q and the values are the quantiles.

DataFrame.quantile

Return a DataFrame, where the columns are the columns of self, and the values are the quantiles.

DataFrameGroupBy.quantile

Return a DataFrame, where the columns are groupby columns, and the values are its quantiles.

Notes

List-like q is not yet supported.

Examples

For Series:

>>> lst1 = pd.date_range('2020-01-01', periods=4, freq='1D')
>>> ser1 = pd.Series([1, 2, 3, 4], index=lst1)
>>> ser1
2020-01-01    1
2020-01-02    2
2020-01-03    3
2020-01-04    4
Freq: None, dtype: int64
Copy
>>> ser1.resample('2D').quantile()
2020-01-01    1.5
2020-01-03    3.5
Freq: None, dtype: float64
Copy

For DataFrame:

>>> data = [[1, 8, 2], [1, 2, 5], [2, 5, 8], [2, 6, 9]]
>>> df = pd.DataFrame(data,
...      columns=["a", "b", "c"],
...      index=pd.date_range('2020-01-01', periods=4, freq='1D'))
>>> df
            a  b  c
2020-01-01  1  8  2
2020-01-02  1  2  5
2020-01-03  2  5  8
2020-01-04  2  6  9
Copy
>>> df.resample('2D').quantile(q=0.2)
              a      b    c
2020-01-01  1.0  3.199  2.6
2020-01-03  2.0  5.200  8.2
Copy