Subscript

subscript(_:)

Creates a subset of the column by masking its elements with another untyped column.

Declaration

subscript(mask: MLUntypedColumn) -> MLUntypedColumn { get }

Parameters

mask

An untyped column indicating whether elements should be removed (a default value) or included (any nondefault value) in the derived column.

Return Value

A new column.

Discussion

Use this untyped column–based subscript to create a new column by masking a subset of the elements. The derived column will not include elements where mask contains a default value for its underlying type, such as:

  • 0 in untyped Int columns

  • 0.0 in untyped Double columns

  • An empty string in untyped String columns

The derived column includes elements where the masking column has any other (nondefault) value.

See subscript(_:) from MLDataTable for an example.

See Also

Masking Elements to Generate an Untyped Column

subscript(MLDataColumn<Bool>) -> MLUntypedColumn

Creates a subset of the column by masking its elements with a data column of Booleans.