dataFrame.rows — chunksOptimal()

Description

The chunksOptimal() method of the rows object returns an array assigning each row to an automatically calculated chunk. Chunk sizes are distributed as evenly as possible while remaining between the specified minimum and maximum sizes.

Signature

dataFrame.rows.chunksOptimal(sizeMin, sizeMax)
Scope
dataFrame
Family
rows
Returns
array

Argument

sizeMin (number)
The minimum number of rows per chunk.
sizeMax (number)
The maximum number of rows per chunk.

Returns

mask ( number[] )
An array containing the optimal chunk index assigned to each row.

Example

// get the chunks for a given dataFrame, with a size between 10 and 20
var mask = df.rows.chunksOptimal(10, 20);

// set a new column with the chunks indexes
dataFrame.column('chunk').set(mask);