atanh
Computes inverse hyperbolic tangent of the input column. Supports Spark Connect.
For the corresponding Databricks SQL function, see atanh function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.atanh(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| target column to compute on. |
Returns
pyspark.sql.Column: the column for computed results.
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(-0.5,), (0.0,), (0.5,)], ["value"])
df.select("*", dbf.atanh(df.value)).show()
Output
+-----+-------------------+
|value| ATANH(value)|
+-----+-------------------+
| -0.5|-0.5493061443340...|
| 0.0| 0.0|
| 0.5| 0.5493061443340...|
+-----+-------------------+
Python
from pyspark.databricks.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (-2), (2), (FLOAT('NAN')), (NULL) AS TAB(value)").select("*", dbf.atanh("value")).show()
Output
+-----+------------+
|value|ATANH(value)|
+-----+------------+
| -2.0| NaN|
| 2.0| NaN|
| NaN| NaN|
| NULL| NULL|
+-----+------------+