tabsdata.tableframe.selectors.alphanumeric#

alphanumeric(ascii_only: bool = False, *, ignore_spaces: bool = False) SelectorProxy[source]#

Select all columns whose names contain only letters and digits.

Parameters:
  • ascii_only – Only consider alphabetic the ASCII letters.

  • ignore_spaces – Consider only non-white characters in column names.

Example

>>> import tabsdata.tableframe as td_tf
>>>
>>> tf = td_tf.TableFrame({
...     "User01": [101, 102, 103, 104, 105, 106, 107, 108],
...     "Col_2": [8, 7, 6, 5, 4, 3, 2, 1],
...     "Data3": [10, 20, 30, 40, 50, 60, 70, 80],
...     "Label": ["a", "b", "c", "d", "e", "f", "g", "h"]
... })

Original: ┌────────┬───────┬───────┬───────┐ │ User01 ┆ Col_2 ┆ Data3 ┆ Label │ │ — ┆ — ┆ — ┆ — │ │ i64 ┆ i64 ┆ i64 ┆ str │ ╞════════╪═══════╪═══════╪═══════╡ │ 101 ┆ 8 ┆ 10 ┆ “a” │ │ 102 ┆ 7 ┆ 20 ┆ “b” │ │ 103 ┆ 6 ┆ 30 ┆ “c” │ │ 104 ┆ 5 ┆ 40 ┆ “d” │ │ 105 ┆ 4 ┆ 50 ┆ “e” │ │ 106 ┆ 3 ┆ 60 ┆ “f” │ │ 107 ┆ 2 ┆ 70 ┆ “g” │ │ 108 ┆ 1 ┆ 80 ┆ “h” │ └────────┴───────┴───────┴───────┘

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

Selected: ┌────────┬───────┬───────┐ │ User01 ┆ Data3 ┆ Label │ │ — ┆ — ┆ — │ │ i64 ┆ i64 ┆ str │ ╞════════╪═══════╪═══════╡ │ 101 ┆ 10 ┆ “a” │ │ 102 ┆ 20 ┆ “b” │ │ 103 ┆ 30 ┆ “c” │ │ 104 ┆ 40 ┆ “d” │ │ 105 ┆ 50 ┆ “e” │ │ 106 ┆ 60 ┆ “f” │ │ 107 ┆ 70 ┆ “g” │ │ 108 ┆ 80 ┆ “h” │ └────────┴───────┴───────┘