pyspark.sql.functions.acosh#
- pyspark.sql.functions.acosh(col)[source]#
Mathematical Function: Computes the inverse hyperbolic cosine (also known as arcosh) of the given column or expression.
New in version 3.1.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or column name The target column or expression to compute the inverse hyperbolic cosine on.
- col
- Returns
Column
A new column object representing the inverse hyperbolic cosine of the input.
Examples
Example 1: Compute the inverse hyperbolic cosine
>>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame([(1,), (2,)], ["value"]) >>> df.select("*", sf.acosh(df.value)).show() +-----+------------------+ |value| ACOSH(value)| +-----+------------------+ | 1| 0.0| | 2|1.3169578969248...| +-----+------------------+
Example 2: Compute the inverse hyperbolic cosine of invalid values
>>> from pyspark.sql import functions as sf >>> spark.sql( ... "SELECT * FROM VALUES (-0.5), (0.5), (NULL) AS TAB(value)" ... ).select("*", sf.acosh("value")).show() +-----+------------+ |value|ACOSH(value)| +-----+------------+ | -0.5| NaN| | 0.5| NaN| | NULL| NULL| +-----+------------+