pow
Returns the value of the first argument raised to the power of the second argument. Supports Spark Connect.
For the corresponding Databricks SQL function, see pow function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.pow(col1=<col1>, col2=<col2>)
# Or
dbf.power(col1=<col1>, col2=<col2>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| the base number. |
|
| the exponent number. |
Returns
pyspark.sql.Column: the base rased to the power the argument.
Examples
Python
from pyspark.databricks.sql import functions as dbf
spark.range(5).select("*", dbf.pow("id", 2)).show()
Output
+---+------------+
| id|POWER(id, 2)|
+---+------------+
| 0| 0.0|
| 1| 1.0|
| 2| 4.0|
| 3| 9.0|
| 4| 16.0|
+---+------------+