quantile()関数


Series. quantile
(
q=0.5, 
interpolation='linear'
)
Parameters:
q : float or array-like, default 0.5 (50% quantile)
0 <= q <= 1, the quantile(s) to compute
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 and j:
linear: i + (j - i) * fraction, where fraction is the fractional part of the index surrounded by i and j.
lower: i.
higher: j.
nearest: i or j whichever is nearest.
midpoint: (i + j)/2.
Returns:
quantile : float or Series
if  q  is an array, a Series will be returned where the index is  q  and the values are the quantiles.
-q:float or array-like,default 0.5(50%quantileすなわち中位数-第2四分位数)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’}当選中の得点点が2つの数値データ点i and jの間にある場合:linear:i+(j-i)*fraction,fractionは計算されたposの小数部(次の例でこのfractionを理解することができる).    lower: i.    higher: j.    nearest: i or j whichever is nearest.
    midpoint: (i + j)/2.
統計学上の四分関数
原則としてqは0から1の間の任意の値をとることができる.しかし、四分位数はq分位数の中で有名です.
いわゆる四分位数;すなわち,数値を小さいものから大きいものに並べて4等分し,3つの分割点位置にある数値が4分位数である.
  • 第1四分位数(Q 1)は、「より小さい四分位数」とも呼ばれ、このサンプルのすべての数値が小さいから大きいまで並べられた25%の数字に等しい.
  • 第2四分位数(Q 2)は、「中位数」とも呼ばれ、このサンプルのすべての数値が小さいから大きいまで並べられた50%の数字に等しい.
  • 第3四分位数(Q 3)は、「大きな四分位数」とも呼ばれ、このサンプルのすべての数値が小さいから大きいまで並んだ75%の数字に等しい.

  • 第3四分位数と第1四分位数の差を四分位距離(InterQuartile Range,IQR)と呼ぶ
    q=0.25 0.5 0.75の場合、四分位数を計算します.
    Return value at the given quantile, a la numpy.percentile
    DataFrame.
    quantile
    (
    q=0.5, 
    axis=0, 
    numeric_only=True
    )
    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
    Returns:
    quantiles : Series or DataFrame
    If q is an array, a DataFrame will be returned where the index is q, 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.
    Return values at the given quantile over requested axis, a la numpy.percentile.
    関連情報:
    https://www.zhihu.com/question/58421946.