Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Computes the exponential of the given value minus one. Supports Spark Connect.
For the corresponding Databricks SQL function, see expm1 function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.expm1(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
column to calculate exponential for. |
Returns
pyspark.sql.Column: exponential less one.
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.sql("SELECT id AS value FROM RANGE(5)")
df.select("*", dbf.expm1(df.value)).show()
+-----+------------------+
|value| EXPM1(value)|
+-----+------------------+
| 0| 0.0|
| 1| 1.718281828459...|
| 2| 6.38905609893...|
| 3|19.085536923187...|
| 4|53.598150033144...|
+-----+------------------+
from pyspark.databricks.sql import functions as dbf
spark.sql(
"SELECT * FROM VALUES (FLOAT('NAN')), (NULL) AS TAB(value)"
).select("*", dbf.expm1("value")).show()
+-----+------------+
|value|EXPM1(value)|
+-----+------------+
| NaN| NaN|
| NULL| NULL|
+-----+------------+