dataFrame.column.stat — frequency()

Description

The frequency() method of the stat object returns the frequencies of the values in the selected column.

Signature

dataFrame.column(columnName).stat.frequency({ proportion: false })
Scope
column
Family
stat
Returns
object

Arguments

columnName (string)
The name of the column from which to calculate values frequency.
options (object)
Frequency calculation options.

Option

proportion (boolean)
Determines whether frequencies are returned as counts or proportions.
  • Proportions: true
  • Counts: false (default)

Returns

stat (object)
The statistic details computed for the values of the selected column.
frequencies (object)
An object mapping each distinct value to its frequency.
mask (array)
An array containing the frequency assigned to each value of the selected column.

Example

// get frequencies of the values of a column of the dataFrame
var stat = dataFrame.column('revenue').stat.frequency({ proportion: false });

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

// add frequency mask to the DataFrame
dataFrame.column('frequencies').set(stat.mask);