QuestionQ259

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

The code block below must read a CSV from the file path filePath into a DataFrame using the specified schema schema. Choose the response that correctly completes the numbered blanks in the code block to accomplish this task.

Code block:

__1__.__2__.__3__(__4__).format("csv").__5__(__6__)

Explanation

PySpark creates a DataFrame reader through spark.read, applies an explicit schema with .schema(schema), sets CSV as the input format with .format("csv"), and reads the specified path through .load(filePath).

Community Discussion

No comments yet. Be the first to start the discussion!