Last active
April 7, 2020 04:15
-
-
Save vietvudanh/da7841a66846ef227ae00f26cfda386b to your computer and use it in GitHub Desktop.
Spark Dataframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.spark.mllib.random.RandomRDDs | |
import org.apache.spark.sql.{types => T, functions => F} | |
import org.apache.spark.sql.Row | |
// | |
import spark.implicits._ | |
val rdd = RandomRDDs.uniformRDD(spark.sparkContext, 100) | |
var df = rdd.toDF("A") | |
df = df.withColumn("id", F.monotonically_increasing_id()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment