pyspark.sql.functions.sinh#
- pyspark.sql.functions.sinh(col)[source]#
Computes hyperbolic sine of the input column.
New in version 1.4.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or column name hyperbolic angle.
- col
- Returns
Column
hyperbolic sine of the given value, as if computed by java.lang.Math.sinh()
Examples
Example 1: Compute the hyperbolic sine
>>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame([(-1,), (0,), (1,)], ["value"]) >>> df.select("*", sf.sinh(df.value)).show() +-----+-------------------+ |value| SINH(value)| +-----+-------------------+ | -1|-1.1752011936438...| | 0| 0.0| | 1| 1.1752011936438...| +-----+-------------------+
Example 2: Compute the hyperbolic sine of invalid values
>>> from pyspark.sql import functions as sf >>> spark.sql( ... "SELECT * FROM VALUES (FLOAT('NAN')), (NULL) AS TAB(value)" ... ).select("*", sf.sinh("value")).show() +-----+-----------+ |value|SINH(value)| +-----+-----------+ | NaN| NaN| | NULL| NULL| +-----+-----------+