Databricks Machine Learning Associate exam dumps

Databricks Machine Learning Associate practice question 151 of 656

Databricks Certified Machine Learning Associate. Associate level, Databricks. Free question with the correct answer and a full explanation.

Databricks Machine Learning Associate Question 151

Single answer

You are working with a Spark DataFrame in Databricks and want to compute summary statistics, such as mean, standard deviation, min, and max, for a column named 'age'. You decide to use Databricks utilities (dbutils) to perform the task. Which of the following steps will allow you to achieve this?

  1. A

    Use the describe() function on the DataFrame and display the results using show().

  2. B

    Call dbutils.data.summarize() to compute and display the summary statistics.

  3. C

    Use the summary() function on the DataFrame and collect the results.

  4. D

    Call dbutils.fs.stats() on the DataFrame to summarize the 'age' column.

Show answer and explanation

Correct answer: A

Explanation

To compute summary statistics for a Spark DataFrame, you can use the describe() function, which provides basic statistics like count, mean, stddev, min, and max for numeric columns. The show() method is then used to display these results. While the summary() function is also an option, it provides a more detailed set of metrics and is not the best fit for the specific requirements described in the question.

  • A. Correct.

    Correct. The describe() function in Spark provides summary statistics (count, mean, stddev, min, max) for numeric columns. Displaying the results with show() will allow you to see the computed statistics.

  • B. Incorrect.

    Incorrect. dbutils.data.summarize() is not a valid Databricks utility for computing summary statistics. This is a fictional method.

  • C. Incorrect.

    Incorrect. While the summary() function can be used to compute various statistics, it provides a more detailed summary than describe(). However, the question explicitly asks about basic summary statistics, making describe() the more accurate choice.

  • D. Incorrect.

    Incorrect. dbutils.fs.stats() is used to retrieve file system metadata, such as file size and modification time, and is unrelated to DataFrame computations.

Timed practice exam

Take a Databricks Machine Learning Associate practice test under exam conditions

48 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam