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.
Computes the cube-root of the given value. Supports Spark Connect.
For the corresponding Databricks SQL function, see cbrt function.
Syntax
from pyspark.sql import functions as dbf
dbf.cbrt(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
target column to compute on. |
Returns
pyspark.sql.Column: the column for computed results.
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(-8,), (0,), (8,)], ["value"])
df.select("*", dbf.cbrt(df.value)).show()
+-----+-----------+
|value|CBRT(value)|
+-----+-----------+
| -8| -2.0|
| 0| 0.0|
| 8| 2.0|
+-----+-----------+
from pyspark.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (FLOAT('NAN')), (NULL) AS TAB(value)").select("*", dbf.cbrt("value")).show()
+-----+-----------+
|value|CBRT(value)|
+-----+-----------+
| NaN| NaN|
| NULL| NULL|
+-----+-----------+