diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 1e8a23060bdb9..f892331d25186 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -308,8 +308,10 @@ def e(): Returns the float value that is closer than any other to e, the base of the natural logarithms. - >>> sqlContext.createDataFrame([(1,)], ['a']).select((e()).alias('e')).collect() - [Row(e=2.7182818284590451)] + >>> e = sqlContext.createDataFrame([(1,)], ['a']).select((e()).alias('e')).collect() + + >>> round(e[0][0], 10) + 2.7182818285 """ sc = SparkContext._active_spark_context jc = sc._jvm.functions.e() @@ -377,8 +379,10 @@ def pi(): Returns the float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter. - >>> sqlContext.createDataFrame([(1,)], ['a']).select((pi()).alias('pi')).collect() - [Row(pi=3.1415926535897931)] + >>> pi = sqlContext.createDataFrame([(1,)], ['a']).select((pi()).alias('pi')).collect() + + >>> round(pi[0][0], 10) + 3.1415926536 """ sc = SparkContext._active_spark_context jc = sc._jvm.functions.pi()