title: Why does this example result in NaN?
body: <p>I'm looking at the documentation for <code>Statistics.corr</code> in PySpark: <a href="https://spark.apache.org/docs/1.1.0/api/python/pyspark.mllib.stat.Statistics-class.html#corr" rel="nofollow">https://spark.apache.org/docs/1.1.0/api/python/pyspark.mllib.stat.Statistics-class.html#corr</a>.</p>
  
  <p>Why does the correlation here result in <code>NaN</code>?</p>
  
  <pre><code>&gt;&gt;&gt; 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])])
  &gt;&gt;&gt; pearsonCorr = Statistics.corr(rdd)
  &gt;&gt;&gt; print str(pearsonCorr).replace('nan', 'NaN')
  [[ 1.          0.05564149         NaN  0.40047142]
   [ 0.05564149  1.                 NaN  0.91359586]
   [        NaN         NaN  1.                 NaN]
   [ 0.40047142  0.91359586         NaN  1.        ]]
  </code></pre>