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

The code block shown below should return a DataFrame containing only the rows from DataFrame storesDF where the value in column sqft is less than or equal to 25,000 AND the value in column customerSatisfaction is greater than or equal to 30. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

storesDF.__1__(__2__ __3__ __4__)

    Correct Answer: A

    To filter rows in a DataFrame where the values of specific columns meet certain conditions, the method used is 'filter'. The condition expressions should be enclosed in parentheses and separated by an '&' for an AND operation. This ensures only rows meeting both conditions are included. So, the correct answer is 'filter (col("sqft") <= 25000) & (col("customerSatisfaction") >= 30)'.

Discussion
Sowwy1Option: A

A. 1. filter 2. (col("sqft") <= 25000) 3. & 4. (col("customerSatisfaction") >= 30)