From fd8c984a8b97165208e4d31ca830aa9aeba8cd71 Mon Sep 17 00:00:00 2001 From: Qinyi Ding Date: Tue, 29 Sep 2026 23:22:07 -0700 Subject: [PATCH] [DOC-13282] Explain the statistical sampling accessor Clarify existing API behavior without changing executable code. Generated with [Snowflake CoCo](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) Co-authored-by: Snowflake CoCo --- src/snowflake/snowpark/dataframe_stat_functions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/snowflake/snowpark/dataframe_stat_functions.py b/src/snowflake/snowpark/dataframe_stat_functions.py index 5d768c6078..306025f52d 100644 --- a/src/snowflake/snowpark/dataframe_stat_functions.py +++ b/src/snowflake/snowpark/dataframe_stat_functions.py @@ -426,6 +426,12 @@ def sample_by( ) -> "snowflake.snowpark.DataFrame": """Returns a DataFrame containing a stratified sample without replacement, based on a ``dict`` that specifies the fraction for each stratum. + ``df.stat`` is the :class:`DataFrameStatFunctions` accessor for ``df``; + it groups statistical operations and doesn't select a column named + ``stat``. ``df.stat.sample_by(...)``, ``df.sample_by(...)``, and + ``df.sampleBy(...)`` call the same sampling operation. Separate calls + can return different random samples. + Example:: >>> df = session.create_dataframe([("Bob", 17), ("Alice", 10), ("Nico", 8), ("Bob", 12)], schema=["name", "age"])