tabsdata.tableframe.selectors.duration#
- duration(time_unit: Literal['ns', 'us', 'ms'] | Collection[Literal['ns', 'us', 'ms']] | None = None) SelectorProxy [source]#
Select all columns of duration data type.
- Parameters:
time_unit – One or more of the supported time precision units: “ms”, “us”, or “ns”. If omitted, selects datetime columns with any time unit.
Example
>>> import tabsdata.tableframe as td_tf >>> from datetime import timedelta >>> >>> tf = td_tf.TableFrame({ ... "Elapsed": [ ... timedelta(seconds=5), ... timedelta(seconds=10), ... timedelta(seconds=15), ... timedelta(seconds=20), ... timedelta(seconds=25), ... timedelta(seconds=30), ... timedelta(seconds=35), ... timedelta(seconds=40) ... ], ... "Label": ["A", "B", "C", "D", "E", "F", "G", "H"] ... })
Original: ┌───────────┬───────┐ │ Elapsed ┆ Label │ │ — ┆ — │ │ duration ┆ str │ ╞═══════════╪═══════╡ │ 5s ┆ “A” │ │ 10s ┆ “B” │ │ 15s ┆ “C” │ │ 20s ┆ “D” │ │ 25s ┆ “E” │ │ 30s ┆ “F” │ │ 35s ┆ “G” │ │ 40s ┆ “H” │ └───────────┴───────┘
>>> tf.select(td_tf.selectors.duration())
Selected: ┌──────────┐ │ Elapsed │ │ — │ │ duration │ ╞══════════╡ │ 5s │ │ 10s │ │ 15s │ │ 20s │ │ 25s │ │ 30s │ │ 35s │ │ 40s │ └──────────┘