製品
グループ内の値の製品を返します。
構文
Python
from pyspark.sql import functions as sf
sf.product(col)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
|
| 掛け合わせる値を含む列 |
戻り値
pyspark.sql.Column: コンピュート結果の列。
例
Python
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()
Output
+----+--------------+
|mod3|product(value)|
+----+--------------+
| 0| 0.0|
| 1| 28.0|
| 2| 80.0|
+----+--------------+