Spark 创建一个简单的DataFrame示例
scala> val df = sc.parallelize(Seq( (0,"cat26",30.9), (1,"cat67",28.5), (2,"cat56",39.6), (3,"cat8",35.6))).toDF("Hour", "Category", "Value") scala> df.show +----+--------+-----+ |Hour|Category|Value| +----+--------+-----+ | 0| cat26| 30.9| | 1| cat67| 28.5| | 2| cat56| 39.6| | 3| cat8| 35.6| +----+--------+-----+