Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this exam
Question 33

Which of the following operations can be used to return the number of rows in a DataFrame?

    Correct Answer: D

    The count() method in a DataFrame is used to return the number of rows in the DataFrame. It is the standard way to determine the row count. Other options like numberOfRows(), n(), sum(), and countDistinct() are either non-existent or used for different purposes.

Discussion
outwalkerOption: D

The operation that can be used to return the number of rows in a DataFrame is: D. DataFrame.count() The count() method in Spark DataFrame returns the number of rows in the DataFrame, and it is the standard way to determine the row count. Options A, B, C, and E are not valid methods for counting the number of rows in a DataFrame.