Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Compare log result in string.
  • Loading branch information
viirya committed Jun 14, 2015
commit bf96bd9ece95a41fb56151d2167b957fa357136e
8 changes: 4 additions & 4 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,11 @@ def when(condition, value):
def log(col, base=math.e):
"""Returns the first argument-based logarithm of the second argument.

>>> df.select(log(df.age, 10.0).alias('ten')).map(lambda l: round(l.ten, 5)).collect()
[0.30103, 0.69897]
>>> df.select(log(df.age, 10.0).alias('ten')).map(lambda l: str(l.ten)[:7]).collect()
['0.30102', '0.69897']

>>> df.select(log(df.age).alias('e')).map(lambda l: round(l.e, 5)).collect()
[0.69315, 1.60944]
>>> df.select(log(df.age).alias('e')).map(lambda l: str(l.e)[:7]).collect()
['0.69314', '1.60943']
"""
sc = SparkContext._active_spark_context
jc = sc._jvm.functions.log(base, _to_java_column(col))
Expand Down