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

Certified Associate Developer for Apache Spark Exam - Question 18


Which of the following operations can be used to create a DataFrame with a subset of columns from DataFrame storesDF that are specified by name?

Show Answer
Correct Answer: B

To create a DataFrame with a subset of columns specified by name from an existing DataFrame, the appropriate operation is select(). The select() method allows you to specify which columns you want to include in the new DataFrame by passing the column names as arguments.

Discussion

2 comments
Sign in to comment
4be8126Option: B
Apr 26, 2023

The operation that can be used to create a DataFrame with a subset of columns from DataFrame storesDF that are specified by name is storesDF.select(). The select() operation allows you to specify the columns you want to keep in the resulting DataFrame by passing in the column names as arguments. For example, to create a new DataFrame that contains only the columns store_id and store_name from the storesDF DataFrame, you can use the following code: newDF = storesDF.select("store_id", "store_name")

TmDataOption: B
Jun 17, 2023

The select() operation in Spark DataFrame allows you to specify the columns you want to include in the resulting DataFrame. You can provide column names as arguments to the select() operation to create a new DataFrame with only the specified columns.