# dask.dataframe.DataFrame.sample

#### DataFrame.sample(n=None, frac=None, replace=False, random_state=None)

Random sample of items

* **Parameters:**
  **n**
  : Number of items to return is not supported by dask. Use frac
    instead.

  **frac**
  : Approximate fraction of items to return. This sampling fraction is
    applied to all partitions equally. Note that this is an
    **approximate fraction**. You should not expect exactly `len(df) * frac`
    items to be returned, as the exact number of elements selected will
    depend on how your data is partitioned (but should be pretty close
    in practice).

  **replace**
  : Sample with or without replacement. Default = False.

  **random_state**
  : If an int, we create a new RandomState with this as the seed;
    Otherwise we draw from the passed RandomState.

#### SEE ALSO
[`DataFrame.random_split`](dask.dataframe.DataFrame.random_split.html.md#dask.dataframe.DataFrame.random_split)

[`pandas.DataFrame.sample`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sample.html#pandas.DataFrame.sample)

<!-- !! processed by numpydoc !! -->
