MCPcopy
hub / github.com/dask/dask / head

Method head

dask/dataframe/dask_expr/_collection.py:681–699  ·  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

679 return new_collection(expr.ResetIndex(self, drop))
680
681 def head(self, n: int = 5, npartitions=1, compute: bool = True):
682 """First n rows of the dataset
683
684 Parameters
685 ----------
686 n : int, optional
687 The number of rows to return. Default is 5.
688 npartitions : int, optional
689 Elements are only taken from the first ``npartitions``, with a
690 default of 1. If there are fewer than ``n`` rows in the first
691 ``npartitions`` a warning will be raised and any found rows
692 returned. Pass -1 to use all partitions.
693 compute : bool, optional
694 Whether to compute the result, default is True.
695 """
696 out = new_collection(expr.Head(self, n=n, npartitions=npartitions))
697 if compute:
698 out = out.compute()
699 return out
700
701 def tail(self, n: int = 5, compute: bool = True):
702 """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