Skip to content

Commit 6c0cf56

Browse files
committed
chore: add default head/tail
1 parent 54b3825 commit 6c0cf56

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/datafusion/dataframe.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def limit(self, count: int, offset: int = 0) -> DataFrame:
223223
"""
224224
return DataFrame(self.df.limit(count, offset))
225225

226-
def head(self, n: int) -> DataFrame:
226+
def head(self, n: int = 5) -> DataFrame:
227227
"""Return a new :py:class:`DataFrame` with a limited number of rows.
228228
229229
Args:
@@ -234,10 +234,11 @@ def head(self, n: int) -> DataFrame:
234234
"""
235235
return DataFrame(self.df.limit(n, 0))
236236

237-
def tail(self, n: int) -> DataFrame:
237+
def tail(self, n: int = 5) -> DataFrame:
238238
"""Return a new :py:class:`DataFrame` with a limited number of rows.
239239
240-
Be aware this could be potentially expensive due to the size of the frame.
240+
Be aware this could be potentially expensive since the row size needs to be
241+
determined of the dataframe. This is done by collecting it.
241242
242243
Args:
243244
n: Number of rows to take from the tail of the DataFrame.

0 commit comments

Comments
 (0)