dataFrame.column.stat — buckets()

Description

The buckets() method of the stat object returns an array assigning each value of the selected column to a bucket of the specified size.

Signature

dataFrame.column(columnName).stat.buckets(size)
Scope
column
Family
stat
Returns
array

Arguments

columnName (string)
The name of the column from which to calculate buckets.
size (number)
The width of each bucket.

Returns

stat (object)
The statistic details computed for the values of the selected column.
count (number)
The count of distinct buckets.
mask ( string[] )
An array containing the assigned buckets.

Example

// get buckets from values of a column of the dataFrame
var stat = dataFrame.column('revenue').stat.buckets(500);

// log the count of buckets
notebook.log(stat.count);

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