# dask.dataframe.Index.sample

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

  Random sample of items

  Parameters:
    n int, optional

      Number of items to return is not supported by dask. Use frac instead.

    frac float, optional

      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 boolean, optional

      Sample with or without replacement. Default = False.

    random_state int or `np.random.RandomState`

      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`
  `pandas.DataFrame.sample`