Databricks Certified Associate Developer for Apache Spark — Question 94
The code block shown below should return a new DataFrame where rows in DataFrame storesDF with missing values in every column have been dropped. 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__)
Answer options
- A. 1. na 2.drop 3. how 4."any"
- B. 1. na 2.drop 3. subset 4."all"
- C. 1. na 2.drop 3.subset 4. "any"
- D. 1. na 2.drop 3. how 4. "all"
- E. 1. drop 2. na 3. how 4. "all"
Correct answer: D
Explanation
The correct answer is D, as the method `dropna()` requires the argument 'how' to specify the condition for dropping rows. By using 'all', it ensures that only rows with missing values in every column are removed. The other options either use incorrect parameters or do not match the requirements of the function.