daft.DataFrame.sample

daft.DataFrame.sample#

DataFrame.sample(fraction: float, with_replacement: bool = False, seed: Optional[int] = None) DataFrame[source]#

Samples a fraction of rows from the DataFrame

Example

>>> sampled_df = df.sample(0.5)
Parameters:
  • fraction (float) – fraction of rows to sample.

  • with_replacement (bool, optional) – whether to sample with replacement. Defaults to False.

  • seed (Optional[int], optional) – random seed. Defaults to None.

Returns:

DataFrame with a fraction of rows.

Return type:

DataFrame