1. Read into a DataFrame
spark.read builds a DataFrameReader; .csv loads the file into a distributed DataFrame.
spark.read.option("header", true).csv("data.csv")Typorithm · easy
Step 1 of 8 · intro card
DataFrames
spark.read loads data into a DataFrame; chain .option("header", true) so the first row becomes column names. show() previews rows and printSchema() reveals each column's inferred type.
A DataFrame is a distributed table of rows and named, typed columns — Spark's core abstraction for structured data.
spark.read returns a reader; chaining .option("header", true).csv("data.csv") loads the file and treats the first row as headers.
Once loaded, show() prints the first rows as a table and printSchema() lists every column with its inferred type, so you can confirm the data was parsed correctly.
spark.read loads data into a DataFrame.
show() previews the first rows.
printSchema() lists columns and their types.
const df = spark.read.option("header", true).csv("data.csv");
df.show();
df.printSchema();Connect each part of the code to the concept before you type.
spark.read builds a DataFrameReader; .csv loads the file into a distributed DataFrame.
spark.read.option("header", true).csv("data.csv")option("header", true) treats the first row as column names instead of data.
.option("header", true)show() prints the first 20 rows of the DataFrame in a table for a quick look.
df.show();printSchema() prints each column with its inferred type, so you can verify the shape.
df.printSchema();Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.