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

Certified Associate Developer for Apache Spark Exam - Question 116


The code block shown below should return a DataFrame containing all columns from DataFrame storesDF except for column sqft and column customerSatisfaction. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

__1__.__2__(__3__)

Show Answer
Correct Answer: C

To drop columns from a DataFrame in Python (commonly using pandas or PySpark), you need to call the DataFrame's drop method and specify the labels of the columns to be removed. The correct syntax involves calling 'storesDF.drop' and passing the column names as a list of strings. Thus, the appropriate way to execute this code block is 'storesDF.drop("sqft", "customerSatisfaction")'.

Discussion

2 comments
Sign in to comment
Sowwy1Option: C
Apr 2, 2024

It's C

SaiPavan10Option: C
Apr 4, 2024

C is the right choice