log1p
Computes the natural logarithm of the given value plus one. Supports Spark Connect.
For the corresponding Databricks SQL function, see log1p function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.log1p(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| column to calculate natural logarithm for. |
Returns
pyspark.sql.Column: natural logarithm of the "given value plus one".
Examples
Python
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.log1p(dbf.e())).show()
Output
+------------------+
| LOG1P(E())|
+------------------+
|1.3132616875182...|
+------------------+
Python
from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.log(dbf.e() + 1)).show()
Output
+------------------+
| ln((E() + 1))|
+------------------+
|1.3132616875182...|
+------------------+