Table.get
getselectorif_missing
Documentation
Returns the column with the given name or index.
Arguments
selector
: The name or index of the column being looked up.if_missing
: The value to use if the selector isn't present.
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 |