Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this 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__)

    Correct Answer: C

    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
azure_bimonsterOption: C

C is correct from these scenarios

amirshazOption: C

columnRenamed(sourceColName, newColName)

gowthamsaraOption: C

C is correct