How to create DataFrame from Scala's List of Iterables?

后端 未结 5 1225
孤独总比滥情好
孤独总比滥情好 2020-12-02 10:31

I have the following Scala value:

val values: List[Iterable[Any]] = Traces().evaluate(features).toList

and I want to convert it to a DataFr

5条回答
  •  日久生厌
    2020-12-02 11:05

    In Spark 2 we can use DataSet by just converting list to DS by toDS API

    val ds = list.flatMap(_.split(",")).toDS() // Records split by comma 
    

    or

    val ds = list.toDS()
    

    This more convenient than rdd or df

提交回复
热议问题