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

Certified Associate Developer for Apache Spark Exam - Question 135


The code block shown below should return a new DataFrame where column division from DataFrame storesDF has been renamed to column state and column managerName from DataFrame storesDF has been renamed to column managerFullName. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

storesDF. __1__(__2__, __2__).__4__(__5__, __6__)

Show Answer
Correct Answer: AC

To rename columns in a DataFrame, the correct function is 'withColumnRenamed'. The syntax should follow 'sourceColName' and then 'newColName'. Therefore, the correctly filled in blanks are: storesDF.withColumnRenamed('division', 'state').withColumnRenamed('managerName', 'managerFullName').

Discussion

3 comments
Sign in to comment
gowthamsaraOption: C
Jan 11, 2024

C is correct

amirshazOption: C
Jan 24, 2024

columnRenamed(sourceColName, newColName)

azure_bimonsterOption: C
Feb 9, 2024

C is correct from these scenarios