polars.DataFrame.limit¶
- DataFrame.limit(length: int = 5) polars.internals.frame.DF ¶
Get first N rows as DataFrame.
See Also DataFrame.head
- Parameters
- length
Amount of rows to take.
Examples
>>> df = pl.DataFrame( ... { ... "foo": [1, 2, 3], ... "bar": [6, 7, 8], ... "ham": ["a", "b", "c"], ... } ... ) >>> df.limit(2) shape: (2, 3) ┌─────┬─────┬─────┐ │ foo ┆ bar ┆ ham │ │ --- ┆ --- ┆ --- │ │ i64 ┆ i64 ┆ str │ ╞═════╪═════╪═════╡ │ 1 ┆ 6 ┆ a │ ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┤ │ 2 ┆ 7 ┆ b │ └─────┴─────┴─────┘