You are viewing documentation about an older version (1.16.0). View latest version

snowflake.snowpark.functions.approx_percentile_estimate

snowflake.snowpark.functions.approx_percentile_estimate(state: Union[Column, str], percentile: float) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L1145-L1162)

Returns the desired approximated percentile value for the specified t-Digest state. APPROX_PERCENTILE_ESTIMATE(APPROX_PERCENTILE_ACCUMULATE(.)) is equivalent to APPROX_PERCENTILE(.).

Example::
>>> df = session.create_dataframe([1,2,3,4,5], schema=["a"])
>>> df_accu = df.select(approx_percentile_accumulate("a").alias("app_percentile_accu"))
>>> df_accu.select(approx_percentile_estimate("app_percentile_accu", 0.5).alias("result")).show()
------------
|"RESULT"  |
------------
|3.0       |
------------
Copy
Language: English