Page 1 of 1

Which of the following code blocks returns a new DataFrame where column division from DataFrame storesDF has been replac

Posted: Mon Mar 27, 2023 1:39 pm
by answerhappygod
Which of the following code blocks returns a new DataFrame where column division from DataFrame storesDF has been replaced and renamed to column state and column managerName from DataFrame storesDF has been replaced and renamed to column managerFullName?

A. (storesDF.withColumnRenamed(["division", "state"], ["managerName", "managerFullName"])
B. (storesDF.withColumn("state", col("division"))
.withColumn("managerFullName", col("managerName")))
C. (storesDF.withColumn("state", "division")
.withColumn("managerFullName", "managerName"))
D. (storesDF.withColumnRenamed("state", "division")
.withColumnRenamed("managerFullName", "managerName"))
E. (storesDF.withColumnRenamed("division", "state")
.withColumnRenamed("managerName", "managerFullName"))