MCPcopy Create free account
hub / github.com/dask/dask / head

Method head

dask/dataframe/dask_expr/_collection.py:715–733  ·  view source on GitHub ↗

First n rows of the dataset Parameters ---------- n : int, optional The number of rows to return. Default is 5. npartitions : int, optional Elements are only taken from the first ``npartitions``, with a default of 1. If there are f

(self, n: int = 5, npartitions=1, compute: bool = True)

Source from the content-addressed store, hash-verified

713 return new_collection(expr.ResetIndex(self, drop))
714
715 def head(self, n: int = 5, npartitions=1, compute: bool = True):
716 """First n rows of the dataset
717
718 Parameters
719 ----------
720 n : int, optional
721 The number of rows to return. Default is 5.
722 npartitions : int, optional
723 Elements are only taken from the first ``npartitions``, with a
724 default of 1. If there are fewer than ``n`` rows in the first
725 ``npartitions`` a warning will be raised and any found rows
726 returned. Pass -1 to use all partitions.
727 compute : bool, optional
728 Whether to compute the result, default is True.
729 """
730 out = new_collection(expr.Head(self, n=n, npartitions=npartitions))
731 if compute:
732 out = out.compute()
733 return out
734
735 def tail(self, n: int = 5, compute: bool = True):
736 """Last n rows of the dataset

Callers

nothing calls this directly

Calls 2

new_collectionFunction · 0.90
computeMethod · 0.45

Tested by

no test coverage detected