nerdexam
Databricks

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)…

Working with Spark DataFrames

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
    1. storesDF
  • B
    1. storesDF
  • C
    1. storesDF
  • D
    1. storesDF
  • E
    1. storesDF

How the community answered

(39 responses)
  • A
    3% (1)
  • B
    5% (2)
  • C
    3% (1)
  • D
    90% (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

#Spark DataFrame#Schema#API Usage#Data Inspection

Community Discussion

No community discussion yet for this question.

Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Practice