snowflake.snowpark.DataFrame.sampleBy¶
- DataFrame.sampleBy(col: ColumnOrName, fractions: Dict[LiteralType, float]) DataFrame[source]¶
Returns a DataFrame containing a stratified sample without replacement, based on a
dictthat specifies the fraction for each stratum.Example:
- Parameters:
col – The name of the column that defines the strata.
fractions – A
dictthat specifies the fraction to use for the sample for each stratum. If a stratum is not specified in thedict, the method uses 0 as the fraction.