pyspark.sql.functions.
log1p
Computes the natural logarithm of the “given value plus one”.
New in version 1.4.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
column to calculate natural logarithm for.
natural logarithm of the “given value plus one”.
Examples
>>> import math >>> df = spark.range(1) >>> df.select(log1p(lit(math.e))).first() Row(LOG1P(2.71828...)=1.31326...)
Same as:
>>> df.select(log(lit(math.e+1))).first() Row(ln(3.71828...)=1.31326...)