Σημείωση
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να συνδεθείτε ή να αλλάξετε καταλόγους.
Η πρόσβαση σε αυτή τη σελίδα απαιτεί εξουσιοδότηση. Μπορείτε να δοκιμάσετε να αλλάξετε καταλόγους.
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|
+----+--------------+