DataFrame.sample

DataFrame.sample(n: int | None = None, frac: float | None = None, random_state: int | None = None) DataFrame[source]

Return n randomly sample rows or the specify fraction of rows

Parameters

nint, optional

Number of documents from index to return. Cannot be used with frac. Default = 1 if frac = None.

fracfloat, optional

Fraction of axis items to return. Cannot be used with n.

random_stateint, optional

Seed for the random number generator.

Returns

opensearch_py_ml.DataFrame:

opensearch_py_ml DataFrame filtered containing n rows randomly sampled

See Also

:pandas_api_docs:`pandas.DataFrame.sample`