Бележка
Достъпът до тази страница изисква удостоверяване. Можете да опитате да влезете или да промените директориите.
Достъпът до тази страница изисква удостоверяване. Можете да опитате да промените директориите.
Returns the product of the values in a group.
Syntax
from pyspark.sql import functions as sf
sf.product(col)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
Column containing values to be multiplied together |
Returns
pyspark.sql.Column: the column for computed results.
Examples
from pyspark.sql import functions as sf
df = spark.sql("SELECT id % 3 AS mod3, id AS value FROM RANGE(10)")
df.groupBy('mod3').agg(sf.product('value')).orderBy('mod3').show()
+----+--------------+
|mod3|product(value)|
+----+--------------+
| 0| 0.0|
| 1| 28.0|
| 2| 80.0|
+----+--------------+