I'm trying to convert an RDD[String] to a Dataframe. The string is comma-separated, so I would like to get one column for each value between commas. To do so, I've tried these steps:
val allNewData_split = allNewData.map(e => e.split(",")) //RDD[Array[String]]
val df_newData = allNewData_split.toDF() //DataFrame
But I'm getting this:
+--------------------+
| value|
+--------------------+
|[0.0, 0.170716979...|
|[0.0, 0.272535901...|
|[0.0, 0.232002948...|
+--------------------+
It is not a duplicate of this post (How to convert rdd object to dataframe in spark) due to I'm asking for RDD[String] instead of RDD[Row].
And it also isn't a duplicate of Spark - load CSV file as DataFrame? because this question isn't about reading a CSV file as DataFrame.