Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
Computes the natural logarithm of the given value plus one. Supports Spark Connect.
For the corresponding Databricks SQL function, see log1p function.
Syntax
from pyspark.sql import functions as dbf
dbf.log1p(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or column name |
column to calculate natural logarithm for. |
Returns
pyspark.sql.Column: natural logarithm of the "given value plus one".
Examples
from pyspark.sql import functions as dbf
spark.range(1).select(dbf.log1p(dbf.e())).show()
+------------------+
| LOG1P(E())|
+------------------+
|1.3132616875182...|
+------------------+
from pyspark.sql import functions as dbf
spark.range(1).select(dbf.log(dbf.e() + 1)).show()
+------------------+
| ln((E() + 1))|
+------------------+
|1.3132616875182...|
+------------------+