Home / ML Associate practice test / Data Processing / Question

Databricks Machine Learning Associate · free practice question

A data scientist wants to explore a large Databricks Spark DataFrame to understand numeric distributions, string column frequencies, and see inline visual…

Exam-style question on Data Processing from the free ML Associate practice test, with the answer and a full explanation below.

Updated November 10, 2026

Data Processing

A data scientist wants to explore a large Databricks Spark DataFrame to understand numeric distributions, string column frequencies, and see inline visual histograms of value distributions — all in a single command without writing extra plotting code. Which tool best satisfies all of these requirements inside a Databricks notebook?

  1. ACall df.summary() and then pipe the resulting statistics DataFrame to matplotlib — df.summary() returns all statistical metrics and automatically renders distribution histograms for each column when its output is passed to matplotlib.show() in a Databricks notebook cell
  2. BCall df.describe() — this PySpark method computes count, mean, stddev, min, and max for numeric and string columns and also renders embedded histograms alongside each metric when executed in a Databricks notebook environment
  3. CUse df.stat.freqItems(['col1', 'col2']) — this method computes frequency distributions across all specified columns and automatically renders interactive visualizations for both numeric and categorical features directly in the Databricks notebook output cell
  4. DCall dbutils.data.summarize(df) — this Databricks utility generates a rich data profile for the entire DataFrame including summary statistics, distinct value counts, and inline histograms of value distributions for numeric, string, and date columns, all rendered directly in the notebook
  5. EConvert the Spark DataFrame to Pandas with .toPandas() and then call pandas_df.describe() — this produces the same comprehensive data profile as dbutils.data.summarize() and automatically renders inline histogram visualizations for each column without requiring additional imports or plotting code
Answer & explanation

Correct answer: D

WHY D: dbutils.data.summarize(df) is the Databricks-specific tool designed to render a full interactive data profile — including summary statistics, null counts, distinct value distributions, and visual histograms for numeric, string, and date columns — in a single call within a Databricks notebook. WHY NOT A: df.summary() returns a statistical summary as a Spark DataFrame but does not automatically render histograms; additional plotting code is required. WHY NOT B: df.describe() provides basic statistics (count, mean, stddev, min, max) but does not render histograms. WHY NOT C: df.stat.freqItems() computes only the most frequent items for specified columns and does not produce a full visual data profile. WHY NOT E: While .toPandas().describe() provides numeric statistics, it does not render histograms automatically and risks out-of-memory errors on large Spark DataFrames; it cannot replicate the inline visual profile produced by dbutils.data.summarize().

Take the full ML Associate practice test free →

Would you pass today?

This question is one of 45 in the free, timed Databricks Machine Learning Associate practice test. Take it and get a section-by-section score.

Start the free test →