dataFrame.column.compare — between()

Description

The between() method of the compare object returns a boolean mask indicating which values fall between the specified minimum and maximum values. Boundaries can be included or excluded using the inclusive option.

Signature

dataFrame.column(columnName).compare.between(minValue, maxValue, { inclusive: false })
Scope
column
Family
compare
Returns
mask

Arguments

columnName (string)
The name of the column to compare values from.
minValue (number)
The lower bound of the comparison range.
maxValue (number)
The upper bound of the comparison range.
options (object)
Comparison options.

Option

inclusive (boolean)
Whether the range boundaries should be included in the comparison.
  • Is inclusive: 1
  • Is not inclusive: 0
  • Default: 0

Returns

mask ( boolean[] )
A boolean mask indicating the rows whose values fall within the specified range.
  • Between the values: 1
  • Otherwise: 0

Example

// higlight rows where the 'revenue' falls between the range 1000 - 2000
var mask = df.column('revenue').compare.between(1000, 2000);

// set mask to dataFrame
df.column('between_1-2k').set(mask)