pyspark.sql.functions.ln#
- pyspark.sql.functions.ln(col)[source]#
- Returns the natural logarithm of the argument. - New in version 3.5.0. - Parameters
- colColumnor str
- a column to calculate logariphm for. 
 
- col
- Returns
- Column
- natural logarithm of given value. 
 
 - 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...| +---+------------------+