DP-500 · Question #10
You are using a Python notebook in an Apache Spark pool in Azure Synapse Analytics. You need to present the data distribution statistics from a DataFrame in a tabular view. Which method should you…
The correct answer is D. describe. To display statistical summaries of a Spark DataFrame in a tabular view, the describe() method should be invoked.
Question
Options
- AfreqItems
- Bexplain
- Crollup
- Ddescribe
How the community answered
(41 responses)- A2% (1)
- B2% (1)
- C5% (2)
- D90% (37)
Why each option
To display statistical summaries of a Spark DataFrame in a tabular view, the describe() method should be invoked.
freqItems is used to find frequent items in a DataFrame, not to generate general statistical summaries.
explain is used to print the physical and logical plans of a DataFrame operation, useful for debugging and optimization, not for data distribution statistics.
rollup is an aggregation function used to create sub-total and grand-total rows, similar to SQL's ROLLUP, and does not directly provide overall distribution statistics.
The describe() method on a Spark DataFrame computes and displays common summary statistics for numerical columns, such as count, mean, standard deviation, min, and max, providing a tabular view of data distribution.
Concept tested: PySpark DataFrame descriptive statistics
Source: https://spark.apache.org/docs/latest/api/python/reference/api/pyspark.sql.DataFrame.describe.html
Topics
Community Discussion
No community discussion yet for this question.