-
DataFrameGroupBy.quantile(q=0.5, axis=0, numeric_only=True, interpolation='linear')
-
Return values at the given quantile over requested axis, a la numpy.percentile.
Parameters: q : float or array-like, default 0.5 (50% quantile)
0 <= q <= 1, the quantile(s) to compute
axis : {0, 1, ?index?, ?columns?} (default 0)
0 or ?index? for row-wise, 1 or ?columns? for column-wise
interpolation : {?linear?, ?lower?, ?higher?, ?midpoint?, ?nearest?}
New in version 0.18.0.
This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points
i
andj
:- linear:
i + (j - i) * fraction
, wherefraction
is the fractional part of the index surrounded byi
andj
. - lower:
i
. - higher:
j
. - nearest:
i
orj
whichever is nearest. - midpoint: (
i
+j
) / 2.
Returns: quantiles : Series or DataFrame
- If
q
is an array, a DataFrame will be returned where the index isq
, the columns are the columns of self, and the values are the quantiles. - If
q
is a float, a Series will be returned where the index is the columns of self and the values are the quantiles.
Examples
>>> df = DataFrame(np.array([[1, 1], [2, 10], [3, 100], [4, 100]]), columns=['a', 'b']) >>> df.quantile(.1) a 1.3 b 3.7 dtype: float64 >>> df.quantile([.1, .5]) a b 0.1 1.3 3.7 0.5 2.5 55.0
- linear:
DataFrameGroupBy.quantile()
2017-01-12 04:47:01
Please login to continue.