
Databricks Certified Associate Developer for Apache Spark
Get started today
Ultimate access to all questions.
Which of the following code blocks returns a new DataFrame where column division
from DataFrame storesDF
has been renamed to state
and column managerName
from DataFrame storesDF
has been renamed to managerFullName
?
Which of the following code blocks returns a new DataFrame where column division
from DataFrame storesDF
has been renamed to state
and column managerName
from DataFrame storesDF
has been renamed to managerFullName
?
Exam-Like
Explanation:
The question requires renaming columns 'division' to 'state' and 'managerName' to 'managerFullName', which implies the original columns should be replaced. Option E uses withColumnRenamed
correctly to rename both columns. Other options either use incorrect syntax (A, C), create new columns without removing the originals (B), or reverse the renaming logic (D).