From e91ea5e62d337797d30195b7167b32ff15361945 Mon Sep 17 00:00:00 2001 From: Adetoro Akinola Date: Fri, 18 Aug 2023 12:41:00 -0500 Subject: [PATCH] improved explanation of linear interpolation in quantile --- pandas/core/series.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 079366a942f8e..07a28d312781a 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2683,8 +2683,10 @@ def quantile( 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`. + * linear: `i + (j - i) * fraction`, where `fraction` is the proportion + of the distance between `i` and `j`. it refers to the relative position + of the desired quantile value between i and j + hence fraction = (desired_quantile - i) / (j - i) * lower: `i`. * higher: `j`. * nearest: `i` or `j` whichever is nearest.