Skip to content

Commit

Permalink
Changed pyspark/mllib/stat.py doc tests to use NaN instead of nan.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbradley committed Aug 17, 2014
1 parent 32173b7 commit 4e5d15e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/pyspark/mllib/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ def corr(x, y=None, method=None):
>>> rdd = sc.parallelize([Vectors.dense([1, 0, 0, -2]), Vectors.dense([4, 5, 0, 3]),
... Vectors.dense([6, 7, 0, 8]), Vectors.dense([9, 0, 0, 1])])
>>> Statistics.corr(rdd)
array([[ 1. , 0.05564149, nan, 0.40047142],
[ 0.05564149, 1. , nan, 0.91359586],
[ nan, nan, 1. , nan],
[ 0.40047142, 0.91359586, nan, 1. ]])
array([[ 1. , 0.05564149, NaN, 0.40047142],
[ 0.05564149, 1. , NaN, 0.91359586],
[ NaN, NaN, 1. , NaN],
[ 0.40047142, 0.91359586, NaN, 1. ]])
>>> Statistics.corr(rdd, method="spearman")
array([[ 1. , 0.10540926, nan, 0.4 ],
[ 0.10540926, 1. , nan, 0.9486833 ],
[ nan, nan, 1. , nan],
[ 0.4 , 0.9486833 , nan, 1. ]])
array([[ 1. , 0.10540926, NaN, 0.4 ],
[ 0.10540926, 1. , NaN, 0.9486833 ],
[ NaN, NaN, 1. , NaN],
[ 0.4 , 0.9486833 , NaN, 1. ]])
>>> try:
... Statistics.corr(rdd, "spearman")
... print "Method name as second argument without 'method=' shouldn't be allowed."
Expand Down

0 comments on commit 4e5d15e

Please sign in to comment.