
Answer-first summary for fast verification
Answer: DataFrame.withColumnRenamed()
The correct answer is B. DataFrame.withColumnRenamed() is the method used to rename an existing column in a DataFrame. The other options are incorrect: A (renamedColumn) does not exist, C (wlthColumn) is a typo and should be withColumn(), which can replace a column's data but not rename it directly. D (col()) refers to a column object, and E (newColumn()) is not a valid method.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.