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

Which of the following operations can be used to return a new DataFrame from DataFrame storesDF without columns that are specified by name?

    Correct Answer: C

    To remove specific columns from a DataFrame and return a new DataFrame without these columns, you use the drop() operation. The filter() function is used for filtering rows, not columns. The select() function is used to specify which columns to include, not exclude. The subset() function is not a standard DataFrame operation for removing columns. The dropColumn() function is not a commonly used DataFrame method. Therefore, storesDF.drop() is the correct method to achieve this.

Discussion
mehroosaliOption: C

Its C not B

newusernameOption: C

you should be careful; with the question. The specified columns should not be in the new DF therefore it is drop , you specify in drop what you want to remove and they won't be in the new DF

cookiemonster42Option: B

in select you can use * instead of the column names