Which call gives count, mean, standard deviation, min, quartiles and max for a Spark DataFrame?
- Exam domain
- Data Processing20% of the exam
- Difficulty
- Easy
- In this mock
- 10 questions on this domainPractise this domain
Why the exam asks this
Data Processing (20% of the exam)
Objective in the exam guide: Compute summary statistics on a Spark DataFrame using .summary() or dbutils data summaries
Summary statistics are named.
Why C is the answer
df.summary()
summary() returns count, mean, stddev, min, the 25/50/75% quartiles and max. dbutils.data.summarize(df) shows a visual profile in notebooks.
Remember: summary() profiles columns.
How it works
Spark DataFrames expose built-in summary statistics.
In detail
- summary() for statistics.
- dbutils.data.summarize for a visual profile.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. df.cache()Wrong
cache() stores the DataFrame in memory.
B. df.count(), which returns all summary statistics for each column in one callWrongMost tempting
count() returns only the row count.
Why it tempts: count sounds like a summary.
C. df.summary()Right
summary() profiles columns.
D. df.collect()Wrong
collect() brings rows to the driver.
Use case
An illustrative scenario, not a real incident.
Illustrative: summary() shows max age 240, which flags bad records.
See it in different ways
flowchart LR S0["Load DataFrame"] --> S1["df.summary"] --> S2["dbutils.data.summarize"] --> S3["Note issues"]
How to read this chart
- Read it in order: Load DataFrame, then df.summary, then dbutils.data.summarize, then Note issues.
mindmap
root(("Profiling"))
n1["summary"]
n2["Statistics table"]
n3["describe"]
n4["Fewer statistics"]
n5["dbutils.data.summarize"]
n6["Visual profile"]How to read this chart
- The centre is "Profiling".
- "summary" covers "Statistics table".
- "describe" covers "Fewer statistics".
- "dbutils.data.summarize" covers "Visual profile".