Hi,

How about this?

import org.apache.spark.ml.linalg._
val toSV = udf((v: Vector) => v.toDense)
val df = Seq((0.1, Vectors.sparse(16, Array(0, 3), Array(0.1, 0.3))), (0.2,
Vectors.sparse(16, Array(0, 3), Array(0.1, 0.3)))).toDF("a", "b")
df.select(toSV($"b"))

// maropu


On Mon, Nov 14, 2016 at 1:20 PM, janardhan shetty <janardhan...@gmail.com>
wrote:

> Hi,
>
> Is there any easy way of converting a dataframe column from SparseVector
> to DenseVector  using
>
> import org.apache.spark.ml.linalg.DenseVector API ?
>
> Spark ML 2.0
>



-- 
---
Takeshi Yamamuro

Reply via email to