Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
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.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.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|
+---+------------+