calculate_percentile

Function calculate_percentile 

Source
fn calculate_percentile<T: ArrowNumericType>(
    values: Vec<T::Native>,
    percentile: f64,
) -> Option<T::Native>
Expand description

Calculate the percentile value for a given set of values. This function performs an exact calculation by sorting all values.

The percentile is calculated using linear interpolation between closest ranks. For percentile p and n values:

  • If p * (n-1) is an integer, return the value at that position
  • Otherwise, interpolate between the two closest values