Skip to main content

Table.at

atselector

Group: Selections

Documentation

Returns the column with the given name or index.

Arguments

  • selector: The name or index of the column being looked up.

Returns

  • The column with the given name or index, or the if_missing value if the column is not found.

Examples

Get the names of all of the items from the shop inventory.

     table1 = Table.new [['Name', ['John', 'Paul']], ['Age', [25, 35]]]
column1 = table1.get 'Name'

Returns a Column

Name
John
Paul

Get the last column.

     table1 = Table.new [['Name', ['John', 'Paul']], ['Age', [25, 35]]]
column1 = table1.get -1

Returns a Column

Age
25
35

Errors

  • If the column name is not found, a No_Such_Column error is raised.
  • If the column index is out of bounds, an Index_Out_Of_Bounds error is raised.