July 2018
Intermediate to advanced
334 pages
8h 20m
English
The goal of this section is to create a final version of our analysis-ready DataFrame. The createDataFrame method available on SparkSession is suitable, and is shown as follows:
scala> val dataFrame = spark.createDataFrame(featureVectorArray)dataFrame: org.apache.spark.sql.DataFrame = [_1: vector, _2: string]//display the first 20 rows of the new DataFrame 'dataFrame'//Readers are requested to run the show command and see what the contents are, as an exercisescala> dataFrame.show+--------------------+---+| _1| _2|+--------------------+---+|------------------------|-----------------------|----------------------|-----------------------Displaying 20 rows..
As seen earlier, the new DataFrame has two columns, ...
Read now
Unlock full access