Share via


acosh

Computes the inverse hyperbolic cosine (also known as arcosh) of the given column or expression. Supports Spark Connect.

For the corresponding Databricks SQL function, see acosh function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.acosh(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or column name The target column or expression to compute the inverse hyperbolic cosine on.

Returns

pyspark.sql.Column: A new column object representing the inverse hyperbolic cosine of the input.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(1,), (2,)], ["value"])
df.select("*", dbf.acosh(df.value)).show()
+-----+------------------+
|value|      ACOSH(value)|
+-----+------------------+
|    1|               0.0|
|    2|1.3169578969248...|
+-----+------------------+

from pyspark.databricks.sql import functions as dbf
spark.sql(
    "SELECT * FROM VALUES (-0.5), (0.5), (NULL) AS TAB(value)"
).select("*", dbf.acosh("value")).show()
+-----+------------+
|value|ACOSH(value)|
+-----+------------+
| -0.5|         NaN|
|  0.5|         NaN|
| NULL|        NULL|
+-----+------------+