nerdexam
Databricks

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

Which of the following code blocks returns a collection of summary statistics for all columns in DataFrame storesDF?

The correct answer is E. storesDF.describe(). storesDF.describe() called with no arguments returns a summary DataFrame containing count, mean, standard deviation, min, and max for all columns (numeric and string). Options A–D are all invalid: summary("mean") returns only the mean statistic, not a full summary…

Performing Basic DataFrame Operations

Question

Which of the following code blocks returns a collection of summary statistics for all columns in DataFrame storesDF?

Options

  • AstoresDF.summary("mean")
  • BstoresDF.describe(all = True)
  • CstoresDF.describe("all")
  • DstoresDF.summary("all")
  • EstoresDF.describe()

How the community answered

(61 responses)
  • A
    2% (1)
  • B
    7% (4)
  • C
    2% (1)
  • D
    3% (2)
  • E
    87% (53)

Explanation

storesDF.describe() called with no arguments returns a summary DataFrame containing count, mean, standard deviation, min, and max for all columns (numeric and string). Options A–D are all invalid: summary("mean") returns only the mean statistic, not a full summary; describe(all=True) is not a valid parameter signature; describe("all") interprets "all" as a column name, which would fail unless a column named 'all' exists; and summary("all") is not a valid statistic name for the summary() method. Option E is the only call that correctly returns comprehensive summary statistics for all columns.

Topics

#PySpark DataFrame#Descriptive Statistics#Data Exploration#DataFrame API

Community Discussion

No community discussion yet for this question.

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