ln
Returns the natural logarithm of the argument. Supports Spark Connect.
For the corresponding Databricks SQL function, see ln function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.ln(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| A column to calculate logarithm for. |
Returns
pyspark.sql.Column: natural logarithm of given value.
Examples
Python
from pyspark.databricks.sql import functions as dbf
spark.range(10).select("*", dbf.ln('id')).show()
Output
+---+------------------+
| id| ln(id)|
+---+------------------+
| 0| NULL|
| 1| 0.0|
| 2|0.6931471805599...|
| 3|1.0986122886681...|
| 4|1.3862943611198...|
| 5|1.6094379124341...|
| 6| 1.791759469228...|
| 7|1.9459101490553...|
| 8|2.0794415416798...|
| 9|2.1972245773362...|
+---+------------------+