DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #176
The code block shown below should read a parquet at the file path filePath into a DataFrame. Choose the response that correctly fills in the numbered blanks within the code block to complete this…
The correct answer is B. 1. spark. To read a Parquet file into a DataFrame in PySpark, the correct syntax is spark.read.parquet(filePath). The blanks are: 1. spark (the SparkSession), 2. read (the DataFrameReader), 3. parquet (the format-specific method), 4. filePath (the path string). Choice D incorrectly…
Question
The code block shown below should read a parquet at the file path filePath into a DataFrame. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block:
1.2.3(4)
Options
- A1.spark
- B
- spark
- C
- spark
- D
- storesDF
- E
- spark
How the community answered
(48 responses)- A2% (1)
- B88% (42)
- C6% (3)
- D4% (2)
Explanation
To read a Parquet file into a DataFrame in PySpark, the correct syntax is spark.read.parquet(filePath). The blanks are: 1. spark (the SparkSession), 2. read (the DataFrameReader), 3. parquet (the format-specific method), 4. filePath (the path string). Choice D incorrectly starts with storesDF (a DataFrame) instead of spark. Other choices likely differ in the method names used for blanks 2 and 3, such as using format('parquet').load() instead of the shorthand .parquet().
Topics
Community Discussion
No community discussion yet for this question.