Scala Seq创建简单的Spark DataFrame

val goalsDF = Seq(
  ("messi", 2),
  ("messi", 1),
  ("pele", 3),
  ("pele", 1)
).toDF("name", "goals")

goalsDF.show()

+-----+-----+
| name|goals|
+-----+-----+
|messi|    2|
|messi|    1|
| pele|    3|
| pele|    1|
+-----+-----+
posted @ 2020-12-30 18:03  船长博客  阅读(1023)  评论(0编辑  收藏  举报
永远相信美好的事情即将发生!