title: convert Dense Vector to Sparse Vector in PySpark
body: <p>Is there a built in way to create a sparse vector from a dense vector in PySpark? The way I am doing this is the following:</p>
  
  <pre><code>Vectors.sparse(len(denseVector), [(i,j) for i,j in enumerate(denseVector)  if j != 0 ])
  </code></pre>
  
  <p>That satisfies the [size, (index, data)] format. Seems kinda hacky. Is there a more efficient way to do it?</p>