Skip to main content

Column.take

takerange

Group: Selections
Aliases: first, head, keep, last, limit, sample, slice, tail, top

Documentation

Creates a new Column with the specified range of rows from the input Column.

Arguments

  • range: The selection of rows from the table to return.

Returns

A new Column containing the selected rows.

Examples

Select the first row from the "Name" Column.

      table = Table.new [["Name", ["Alice", "Bob", "Charlie"]]]
column = table.get "Name"
## The take returns "Alice"
first_row = column.take (..First 1)

Select the last row from the "Name" Column.

      table = Table.new [["Name", ["Alice", "Bob", "Charlie"]]]
column = table.get "Name"
## The take returns "Charlie"
last_row = column.take (..Last 1)

Errors

  • If the range is out of bounds, an Index_Out_Of_Bounds error is raised.