pyspark.sql.functions.ln#
- pyspark.sql.functions.ln(col)[source]#
Returns the natural logarithm of the argument.
Added in version 3.5.0.
- Parameters:
- col
Columnor str a column to calculate logariphm for. A column that evaluates to a double.
- col
- Returns:
Columnnatural logarithm of given value. Returns a column that evaluates to a double.
See also
Examples
>>> from pyspark.sql import functions as sf >>> spark.range(10).select("*", sf.ln('id')).show() +---+------------------+ | 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...| +---+------------------+