TableFrame.rename
methodView source ↗
def rename(mapping: dict[str, str]) -> TableFrame
Categories: projection
Rename columns from the TableFrame.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌──────┬──────┐
│ i ┆ f │
│ --- ┆ --- │
│ i32 ┆ f64 │
╞══════╪══════╡
│ 1 ┆ 3.1 │
│ 2 ┆ 4.1 │
│ 3 ┆ 5.9 │
│ 4 ┆ 2.6 │
│ 5 ┆ 53.5 │
│ 6 ┆ 8.97 │
└──────┴──────┘
>>>
>>> tf.{"i": "index", "f": "amount"})
>>>
┌───────┬────────┐
│ index ┆ amount │
│ ----- ┆ ------ │
│ i32 ┆ f64 │
╞═══════╪════════╡
│ 1 ┆ 3.1 │
│ 2 ┆ 4.1 │
│ 3 ┆ 5.9 │
│ 4 ┆ 2.6 │
│ 5 ┆ 53.5 │
│ 6 ┆ 8.97 │
└───────┴────────┘