dataFrame.column.stat — percentile()

Description

The percentile() method of the stat object returns the value corresponding to the specified percentile of the selected column.

Signature

dataFrame.column(columnName).stat.percentile(percentile, { sorted: false })
Scope
column
Family
stat
Returns
object

Arguments

columnName (string)
The name of the column from which to calculate the percentile.
percentile (number)
The percentile to compute. Default: 0.9.
options (object)
Percentile calculation options.

Options

sorted (boolean)
Indicates whether the values are already sorted in ascending order.
  • Sorted: true
  • Not sorted: false (default)

Returns

stat (object)
The statistic details computed for the specified percentile.
percentileValue (number)
The value at the specified percentile.
mask ( number[] )
Indicates how each value in the selected column compares with the percentile value:
  •  1: Above percentile
  •  0: Equal to percentile
  • -1: Below percentile

Example

// get the percentile value of a column of the dataFrame
var stat = dataFrame.column('revenue').stat.percentile(0.9);

// log the percentileValue
notebook.log(stat.percentileValue);

// add the percentile mask to the dataFrame
dataFrame.column('mask').set(stat.mask);