Skip to main content
Version: 1.7.0

last

def last() -> SelectorProxy

Categories: projection

Select the last column in the TableFrame.

Useful when working with dynamically generated schemas where the column order is not fixed.

Examples

>>> import tabsdata.tableframe as td_tf
>>>
>>> tf = td_tf.TableFrame({
... "Id": [1, 2, 3, 4, 5, 6, 7, 8],
... "Name": ["A", "B", "C", "D", "E", "F", "G", "H"],
... "Score": [95.0, 88.5, 92.0, 76.0, 84.5, 79.0, 91.0, 87.5]
... })

Original: ┌────┬──────┬───────┐ │ Id ┆ Name ┆ Score │ │ ---┆ --- ┆ --- │ │ i64┆ str ┆ f64 │ ╞════╪══════╪═══════╡ │ 1 ┆ "A" ┆ 95.0 │ │ 2 ┆ "B" ┆ 88.5 │ │ 3 ┆ "C" ┆ 92.0 │ │ 4 ┆ "D" ┆ 76.0 │ │ 5 ┆ "E" ┆ 84.5 │ │ 6 ┆ "F" ┆ 79.0 │ │ 7 ┆ "G" ┆ 91.0 │ │ 8 ┆ "H" ┆ 87.5 │ └────┴──────┴───────┘

>>> tf.select(td_tf.selectors.last())

Selected: ┌───────┐ │ Score │ │ --- │ │ f64 │ ╞═══════╡ │ 95.0 │ │ 88.5 │ │ 92.0 │ │ 76.0 │ │ 84.5 │ │ 79.0 │ │ 91.0 │ │ 87.5 │ └───────┘