fatorial
Calcule o fatorial do valor dado. Compatível com Spark Connect.
Para a função Databricks SQL correspondente, consulte a funçãofactorial.
Sintaxe
Python
from pyspark.databricks.sql import functions as dbf
dbf.factorial(col=<col>)
Parâmetros
Parâmetro | Tipo | Descrição |
|---|---|---|
|
| uma coluna para calcular o fatorial. |
Devoluções
pyspark.sql.Column: fatorial de um valor dado.
Exemplos
Python
from pyspark.databricks.sql import functions as dbf
spark.range(10).select("*", dbf.factorial('id')).show()
Output
+---+-------------+
| id|factorial(id)|
+---+-------------+
| 0| 1|
| 1| 1|
| 2| 2|
| 3| 6|
| 4| 24|
| 5| 120|
| 6| 720|
| 7| 5040|
| 8| 40320|
| 9| 362880|
+---+-------------+