mpercentile#

swordfish.function.mpercentile()#

Return the percentile rank of each element of X in a sliding window.

Parameters:
  • percent (Constant) – An integer or floating value between 0 and 100.

  • interpolation (Constant) –

    A string indicating the interpolation method to use if the specified percentile is between two elements in X (assuming the \(i^{th}\) and \((i+1)^{th}\) element in the sorted X) . It can take the following values:

    • ’linear’(default): Return \(X_i+(X_i+1-X_1)*fraction\), where \(fraction = \frac{\tfrac{percentile}{100} - \tfrac{i}{size - 1}}{\tfrac{1}{size - 1}}\)

    • ’lower’: Return \(X_i\)

    • ’higher’: Return \(X_{i+1}\)

    • ’nearest’: Return \(X_i\) that is closest to the specified percentile

    • ’midpoint’: Return \(X_i\)

  • minPeriods (Constant) – A positive integer indicating the minimum number of observations in a window required to be not null (otherwise the result is NULL).