TableFrame.clear
methodView source ↗
def clear(n: int = 0) -> TableFrame
Categories: tableframe
Clears all rows of the TableFrame preserving the schema.
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
┌──────┬──────┐
│ a ┆ b │
│ --- ┆ --- │
│ str ┆ i64 │
╞══════╪══════╡
│ A ┆ 1 │
│ X ┆ 10 │
│ C ┆ 3 │
│ D ┆ 5 │
│ M ┆ 9 │
│ A ┆ 100 │
│ M ┆ 50 │
│ null ┆ 20 │
│ F ┆ null │
└──────┴──────┘
>>>
>>> tf.cast({"b":td.Float32}).collect()
>>>
┌──────┬───────┐
│ a ┆ b │
│ --- ┆ --- │
│ str ┆ f32 │
╞══════╪═══════╡
└──────┴───────┘