def sample(self, n: Optional[int]=None, frac: Optional[float]=None, replace: bool=False, random_state: Optional[int]=None) -> 'DataFrame':
    "\n        Return a random sample of items from an axis of object.\n\n        Please call this function using named argument by specifying the ``frac`` argument.\n\n        You can use `random_state` for reproducibility. However, note that different from pandas,\n        specifying a seed in pandas-on-Spark/Spark does not guarantee the sampled rows will\n        be fixed. The result set depends on not only the seed, but also how the data is distributed\n        across machines and to some extent network randomness when shuffle operations are involved.\n        Even in the simplest case, the result set will depend on the system's CPU core count.\n\n        Parameters\n        ----------\n        n : int, optional\n            Number of items to return. This is currently NOT supported. Use frac instead.\n        frac : float, optional\n            Fraction of axis items to return.\n        replace : bool, default False\n            Sample with or without replacement.\n        random_state : int, optional\n            Seed for the random number generator (if int).\n\n        Returns\n        -------\n        Series or DataFrame\n            A new object of same type as caller containing the sampled items.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'num_legs': [2, 4, 8, 0],\n        ...                    'num_wings': [2, 0, 0, 0],\n        ...                    'num_specimen_seen': [10, 2, 1, 8]},\n        ...                   index=['falcon', 'dog', 'spider', 'fish'],\n        ...                   columns=['num_legs', 'num_wings', 'num_specimen_seen'])\n        >>> df  # doctest: +SKIP\n                num_legs  num_wings  num_specimen_seen\n        falcon         2          2                 10\n        dog            4          0                  2\n        spider         8          0                  1\n        fish           0          0                  8\n\n        A random 25% sample of the ``DataFrame``.\n        Note that we use `random_state` to ensure the reproducibility of\n        the examples.\n\n        >>> df.sample(frac=0.25, random_state=1)  # doctest: +SKIP\n                num_legs  num_wings  num_specimen_seen\n        falcon         2          2                 10\n        fish           0          0                  8\n\n        Extract 25% random elements from the ``Series`` ``df['num_legs']``, with replacement,\n        so the same items could appear more than once.\n\n        >>> df['num_legs'].sample(frac=0.4, replace=True, random_state=1)  # doctest: +SKIP\n        falcon    2\n        spider    8\n        spider    8\n        Name: num_legs, dtype: int64\n\n        Specifying the exact number of items to return is not supported at the moment.\n\n        >>> df.sample(n=5)  # doctest: +ELLIPSIS\n        Traceback (most recent call last):\n            ...\n        NotImplementedError: Function sample currently does not support specifying ...\n        "
    if (n is not None):
        raise NotImplementedError('Function sample currently does not support specifying exact number of items to return. Use frac instead.')
    if (frac is None):
        raise ValueError('frac must be specified.')
    sdf = self._internal.resolved_copy.spark_frame.sample(withReplacement=replace, fraction=frac, seed=random_state)
    return DataFrame(self._internal.with_new_sdf(sdf))
Return a random sample of items from an axis of object.

Please call this function using named argument by specifying the ``frac`` argument.

You can use `random_state` for reproducibility. However, note that different from pandas,
specifying a seed in pandas-on-Spark/Spark does not guarantee the sampled rows will
be fixed. The result set depends on not only the seed, but also how the data is distributed
across machines and to some extent network randomness when shuffle operations are involved.
Even in the simplest case, the result set will depend on the system's CPU core count.

Parameters
----------
n : int, optional
    Number of items to return. This is currently NOT supported. Use frac instead.
frac : float, optional
    Fraction of axis items to return.
replace : bool, default False
    Sample with or without replacement.
random_state : int, optional
    Seed for the random number generator (if int).

Returns
-------
Series or DataFrame
    A new object of same type as caller containing the sampled items.

Examples
--------
>>> df = ps.DataFrame({'num_legs': [2, 4, 8, 0],
...                    'num_wings': [2, 0, 0, 0],
...                    'num_specimen_seen': [10, 2, 1, 8]},
...                   index=['falcon', 'dog', 'spider', 'fish'],
...                   columns=['num_legs', 'num_wings', 'num_specimen_seen'])
>>> df  # doctest: +SKIP
        num_legs  num_wings  num_specimen_seen
falcon         2          2                 10
dog            4          0                  2
spider         8          0                  1
fish           0          0                  8

A random 25% sample of the ``DataFrame``.
Note that we use `random_state` to ensure the reproducibility of
the examples.

>>> df.sample(frac=0.25, random_state=1)  # doctest: +SKIP
        num_legs  num_wings  num_specimen_seen
falcon         2          2                 10
fish           0          0                  8

Extract 25% random elements from the ``Series`` ``df['num_legs']``, with replacement,
so the same items could appear more than once.

>>> df['num_legs'].sample(frac=0.4, replace=True, random_state=1)  # doctest: +SKIP
falcon    2
spider    8
spider    8
Name: num_legs, dtype: int64

Specifying the exact number of items to return is not supported at the moment.

>>> df.sample(n=5)  # doctest: +ELLIPSIS
Traceback (most recent call last):
    ...
NotImplementedError: Function sample currently does not support specifying ...
def sample(self, n: Optional[int]=None, frac: Optional[float]=None, replace: bool=False, random_state: Optional[int]=None) -> 'DataFrame':
    "\n        Return a random sample of items from an axis of object.\n\n        Please call this function using named argument by specifying the ``frac`` argument.\n\n        You can use `random_state` for reproducibility. However, note that different from pandas,\n        specifying a seed in pandas-on-Spark/Spark does not guarantee the sampled rows will\n        be fixed. The result set depends on not only the seed, but also how the data is distributed\n        across machines and to some extent network randomness when shuffle operations are involved.\n        Even in the simplest case, the result set will depend on the system's CPU core count.\n\n        Parameters\n        ----------\n        n : int, optional\n            Number of items to return. This is currently NOT supported. Use frac instead.\n        frac : float, optional\n            Fraction of axis items to return.\n        replace : bool, default False\n            Sample with or without replacement.\n        random_state : int, optional\n            Seed for the random number generator (if int).\n\n        Returns\n        -------\n        Series or DataFrame\n            A new object of same type as caller containing the sampled items.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'num_legs': [2, 4, 8, 0],\n        ...                    'num_wings': [2, 0, 0, 0],\n        ...                    'num_specimen_seen': [10, 2, 1, 8]},\n        ...                   index=['falcon', 'dog', 'spider', 'fish'],\n        ...                   columns=['num_legs', 'num_wings', 'num_specimen_seen'])\n        >>> df  # doctest: +SKIP\n                num_legs  num_wings  num_specimen_seen\n        falcon         2          2                 10\n        dog            4          0                  2\n        spider         8          0                  1\n        fish           0          0                  8\n\n        A random 25% sample of the ``DataFrame``.\n        Note that we use `random_state` to ensure the reproducibility of\n        the examples.\n\n        >>> df.sample(frac=0.25, random_state=1)  # doctest: +SKIP\n                num_legs  num_wings  num_specimen_seen\n        falcon         2          2                 10\n        fish           0          0                  8\n\n        Extract 25% random elements from the ``Series`` ``df['num_legs']``, with replacement,\n        so the same items could appear more than once.\n\n        >>> df['num_legs'].sample(frac=0.4, replace=True, random_state=1)  # doctest: +SKIP\n        falcon    2\n        spider    8\n        spider    8\n        Name: num_legs, dtype: int64\n\n        Specifying the exact number of items to return is not supported at the moment.\n\n        >>> df.sample(n=5)  # doctest: +ELLIPSIS\n        Traceback (most recent call last):\n            ...\n        NotImplementedError: Function sample currently does not support specifying ...\n        "
    if (n is not None):
        raise NotImplementedError('Function sample currently does not support specifying exact number of items to return. Use frac instead.')
    if (frac is None):
        raise ValueError('frac must be specified.')
    sdf = self._internal.resolved_copy.spark_frame.sample(withReplacement=replace, fraction=frac, seed=random_state)
    return DataFrame(self._internal.with_new_sdf(sdf))