read a csv file in spark scala code example
Example 1: read csv in spark
df = spark.read.format("csv").option("header", "true").load("csvfile.csv")
Example 2: read csv in spark
df = spark. read . format("csv") . option("header", "true")
df = spark.read.format("csv").option("header", "true").load("csvfile.csv")
df = spark. read . format("csv") . option("header", "true")