
Answer-first summary for fast verification
Answer: storesDF.select(), storesDF.drop()
To create a DataFrame with a subset of columns specified by name, the correct operations are: 1. **select()**: This method is used to select specific columns by name to include in the new DataFrame. 2. **drop()**: This method is used to exclude specific columns by name, resulting in a new DataFrame with the remaining columns. - **A (subset())**: Incorrect, as there is no such method in Spark. - **B (select())**: Correct, as it allows selecting columns by name. - **C (selectColumn())**: Incorrect, as this is not a valid method in Spark. - **D (filter())**: Incorrect, as it is used for filtering rows, not selecting columns. - **E (drop())**: Correct, as it allows excluding columns by name, effectively creating a subset of the remaining columns.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.