snowflake.snowpark.functions.approx_percentile_accumulate

snowflake.snowpark.functions.approx_percentile_accumulate(col: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L1112-L1142)

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
语言: 中文