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…
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)- A2% (1)
- B7% (4)
- C2% (1)
- D3% (2)
- E87% (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
Community Discussion
No community discussion yet for this question.