Skip to content

bmel:percentile-of

Category: Array & Statistics · Returns: bmel:number

Signature
bmel:percentile-of(array: bmel:array<number>, p: bmel:number)

Description

Returns the p-th percentile of all numeric values in an array using linear interpolation (equivalent to NumPy percentile / Excel PERCENTILE.INC). p must be between 0 and 100 inclusive. Examples: p=50 gives the median, p=75 gives Q3, p=25 gives Q1.

Arguments

Parameter Type Required Description
array bmel:array<number> The array of numeric values to evaluate.
p bmel:number Percentile to compute, expressed as a number between 0 and 100 inclusive (e.g. 90 for the 90th percentile).

Examples

p90 of the tokens used per call
bmel:percentile-of({createChatCompletion:Response Payload[]}.$.usage.total_tokens, 90)
Price at the 75th percentile
bmel:percentile-of({getOrder:Response Payload}.$.items.price, 75)

← Back to BMEL Reference