Skip to content

Commit

Permalink
docs(python): Add docstring example for DataFrame.limit() (#16753)
Browse files Browse the repository at this point in the history
  • Loading branch information
montanarograziano authored Jun 6, 2024
1 parent a7f9c8d commit 5c8b6c5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5066,6 +5066,29 @@ def limit(self, n: int = 5) -> Self:
See Also
--------
head
Examples
--------
Get the first 3 rows of a DataFrame.
>>> df = pl.DataFrame(
... {
... "foo": [1, 2, 3, 4, 5],
... "bar": [6, 7, 8, 9, 10],
... "ham": ["a", "b", "c", "d", "e"],
... }
... )
>>> df.limit(3)
shape: (3, 3)
┌─────┬─────┬─────┐
│ foo ┆ bar ┆ ham │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ str │
╞═════╪═════╪═════╡
│ 1 ┆ 6 ┆ a │
│ 2 ┆ 7 ┆ b │
│ 3 ┆ 8 ┆ c │
└─────┴─────┴─────┘
"""
return self.head(n)

Expand Down

0 comments on commit 5c8b6c5

Please sign in to comment.