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

snowflake.snowpark.functions.approx_percentile_accumulate¶

snowflake.snowpark.functions.approx_percentile_accumulate(col: Union[Column, str]) → Column[source]¶

Returns the internal representation of the t-Digest state (as a JSON object) at the end of aggregation. This function uses the t-Digest algorithm.

Example::
>>> df = session.create_dataframe([1,2,3,4,5], schema=["a"])
>>> df.select(approx_percentile_accumulate("a").alias("result")).show()
------------------------------
|"RESULT"                    |
------------------------------
|{                           |
|  "state": [                |
|    1.000000000000000e+00,  |
|    1.000000000000000e+00,  |
|    2.000000000000000e+00,  |
|    1.000000000000000e+00,  |
|    3.000000000000000e+00,  |
|    1.000000000000000e+00,  |
|    4.000000000000000e+00,  |
|    1.000000000000000e+00,  |
|    5.000000000000000e+00,  |
|    1.000000000000000e+00   |
|  ],                        |
|  "type": "tdigest",        |
|  "version": 1              |
|}                           |
------------------------------
Copy