Skip to content

Commit bf96bd9

Browse files
committed
Compare log result in string.
1 parent 102070d commit bf96bd9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/pyspark/sql/functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,11 @@ def when(condition, value):
408408
def log(col, base=math.e):
409409
"""Returns the first argument-based logarithm of the second argument.
410410
411-
>>> df.select(log(df.age, 10.0).alias('ten')).map(lambda l: round(l.ten, 5)).collect()
412-
[0.30103, 0.69897]
411+
>>> df.select(log(df.age, 10.0).alias('ten')).map(lambda l: str(l.ten)[:7]).collect()
412+
['0.30102', '0.69897']
413413
414-
>>> df.select(log(df.age).alias('e')).map(lambda l: round(l.e, 5)).collect()
415-
[0.69315, 1.60944]
414+
>>> df.select(log(df.age).alias('e')).map(lambda l: str(l.e)[:7]).collect()
415+
['0.69314', '1.60943']
416416
"""
417417
sc = SparkContext._active_spark_context
418418
jc = sc._jvm.functions.log(base, _to_java_column(col))

0 commit comments

Comments
 (0)