Skip to content

Commit 102070d

Browse files
committed
Round log result to better comparing in python test.
1 parent fd01863 commit 102070d

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')).collect()
412-
[Row(ten=0.30102999566398114), Row(ten=0.6989700043360187)]
411+
>>> df.select(log(df.age, 10.0).alias('ten')).map(lambda l: round(l.ten, 5)).collect()
412+
[0.30103, 0.69897]
413413
414-
>>> df.select(log(df.age).alias('e')).collect()
415-
[Row(e=0.6931471805597018), Row(e=1.609437912433535)]
414+
>>> df.select(log(df.age).alias('e')).map(lambda l: round(l.e, 5)).collect()
415+
[0.69315, 1.60944]
416416
"""
417417
sc = SparkContext._active_spark_context
418418
jc = sc._jvm.functions.log(base, _to_java_column(col))

0 commit comments

Comments
 (0)