vectors.dense pyspark code example
Example: pyspark dense
import pyspark.sql.functions as F
import pyspark.sql.types as T
#or: to_array = F.udf(lambda v: list([float(x) for x in v]), T.ArrayType(T.FloatType()))
to_array = F.udf(lambda v: v.toArray().tolist(), T.ArrayType(T.FloatType()))
df = df.withColumn('features', to_array('features'))