tabsdata.tableframe.selectors.ends_with#
- ends_with(*suffix: str) SelectorProxy [source]#
Select all columns whose names end with any of the given suffixes.
- Parameters:
suffix – One or more string suffixes to match at the end of column names.
Example
>>> import tabsdata.tableframe as td_tf >>> >>> tf = td_tf.TableFrame({ ... "Id": [1, 2, 3, 4, 5, 6, 7, 8], ... "UserId": [100, 101, 102, 103, 104, 105, 106, 107], ... "SessionId": [201, 202, 203, 204, 205, 206, 207, 208], ... "Value": [10.5, 20.0, 15.5, 12.0, 18.5, 17.0, 16.0, 19.5] ... })
Original: ┌──────┬────────┬───────────┬───────┐ │ Id ┆ UserId ┆ SessionId ┆ Value │ │ — ┆ — ┆ — ┆ — │ │ i64 ┆ i64 ┆ i64 ┆ f64 │ ╞══════╪════════╪═══════════╪═══════╡ │ 1 ┆ 100 ┆ 201 ┆ 10.5 │ │ 2 ┆ 101 ┆ 202 ┆ 20.0 │ │ 3 ┆ 102 ┆ 203 ┆ 15.5 │ │ 4 ┆ 103 ┆ 204 ┆ 12.0 │ │ 5 ┆ 104 ┆ 205 ┆ 18.5 │ │ 6 ┆ 105 ┆ 206 ┆ 17.0 │ │ 7 ┆ 106 ┆ 207 ┆ 16.0 │ │ 8 ┆ 107 ┆ 208 ┆ 19.5 │ └──────┴────────┴───────────┴───────┘
>>> tf.select(td_tf.selectors.ends_with("Id"))
Selected: ┌──────┬────────┬───────────┐ │ Id ┆ UserId ┆ SessionId │ │ — ┆ — ┆ — │ │ i64 ┆ i64 ┆ i64 │ ╞══════╪════════╪═══════════╡ │ 1 ┆ 100 ┆ 201 │ │ 2 ┆ 101 ┆ 202 │ │ 3 ┆ 102 ┆ 203 │ │ 4 ┆ 103 ┆ 204 │ │ 5 ┆ 104 ┆ 205 │ │ 6 ┆ 105 ┆ 206 │ │ 7 ┆ 106 ┆ 207 │ │ 8 ┆ 107 ┆ 208 │ └──────┴────────┴───────────┘