Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
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 |
|---|---|---|
col1 |
pyspark.sql.Column, column name or float |
the base number. |
col2 |
pyspark.sql.Column, column name or float |
the exponent number. |
Returns
pyspark.sql.Column: the base rased to the power the argument.
Examples
from pyspark.databricks.sql import functions as dbf
spark.range(5).select("*", dbf.pow("id", 2)).show()
+---+------------+
| id|POWER(id, 2)|
+---+------------+
| 0| 0.0|
| 1| 1.0|
| 2| 4.0|
| 3| 9.0|
| 4| 16.0|
+---+------------+