nerdexam
Databricks

DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #76

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 E. 1. storesDF. The correct method to print a DataFrame's schema is storesDF.printSchema(). This prints the schema as a formatted tree showing each column's name, data type, and nullability (e.g., |-- division: string (nullable = true)). The property storesDF.schema also exists but returns a…

Working with 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

Options

  • A
    1. storesDF
  • B
    1. storesDF
  • C
    1. storesDF
  • D
    1. storesDF
  • E
    1. storesDF

How the community answered

(27 responses)
  • C
    7% (2)
  • D
    4% (1)
  • E
    89% (24)

Explanation

The correct method to print a DataFrame's schema is storesDF.printSchema(). This prints the schema as a formatted tree showing each column's name, data type, and nullability (e.g., |-- division: string (nullable = true)). The property storesDF.schema also exists but returns a StructType object rather than printing anything. Option E fills in blank 2 with printSchema(), which is the only method in the Spark DataFrame API that produces printed schema output.

Topics

#Spark DataFrame API#Schema Operations#Data Inspection#PySpark

Community Discussion

No community discussion yet for this question.

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