DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #171
The code block shown below should print the schema of DataFrame storesDF. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block…
The correct answer is D. 1. storesDF. To print the schema of a DataFrame in PySpark, the correct syntax is storesDF.printSchema(). The method printSchema() takes no arguments and displays the column names and their data types in a tree format. Answer D fills the blanks as: 1. storesDF, 2. printSchema, 3. (empty)…
Question
The code block shown below should print the schema of DataFrame storesDF. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block:
1.2(3)
Options
- A
- storesDF
- B
- storesDF
- C
- storesDF
- D
- storesDF
- E
- storesDF
How the community answered
(39 responses)- A3% (1)
- B5% (2)
- C3% (1)
- D90% (35)
Explanation
To print the schema of a DataFrame in PySpark, the correct syntax is storesDF.printSchema(). The method printSchema() takes no arguments and displays the column names and their data types in a tree format. Answer D fills the blanks as: 1. storesDF, 2. printSchema, 3. (empty). Other choices likely use incorrect method names such as schema(), getSchema(), or pass incorrect arguments.
Topics
Community Discussion
No community discussion yet for this question.