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 hyperbolic cosine of the input column. Supports Spark Connect.
For the corresponding Databricks SQL function, see cosh function.
Syntax
from pyspark.sql import functions as dbf
dbf.cosh(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
hyperbolic angle |
Returns
pyspark.sql.Column: hyperbolic cosine of the angle, as if computed by java.lang.Math.cosh()
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([(-1,), (0,), (1,)], ["value"])
df.select("*", dbf.cosh(df.value)).show()
+-----+-----------------+
|value| COSH(value)|
+-----+-----------------+
| -1|1.543080634815...|
| 0| 1.0|
| 1|1.543080634815...|
+-----+-----------------+
from pyspark.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (FLOAT('NAN')), (NULL) AS TAB(value)").select("*", dbf.cosh("value")).show()
+-----+-----------+
|value|COSH(value)|
+-----+-----------+
| NaN| NaN|
| NULL| NULL|
+-----+-----------+