pyspark.sql.functions.ln

pyspark.sql.functions.ln(col: ColumnOrName) → pyspark.sql.column.Column[source]

Returns the natural logarithm of the argument.

New in version 3.5.0.

Parameters
colColumn or str

a column to calculate logariphm for.

Returns
Column

natural logarithm of given value.

Examples

>>> df = spark.createDataFrame([(4,)], ['a'])
>>> df.select(ln('a')).show()
+------------------+
|             ln(a)|
+------------------+
|1.3862943611198906|
+------------------+