QuestionQ268

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

Which of the following code blocks returns a new DataFrame in which the division column from DataFrame storesDF has been renamed to state, and the managerName column from DataFrame storesDF has been renamed to managerFullName?

Explanation

PySpark DataFrame.withColumnRenamed(existing, new) returns a new DataFrame with the specified existing column renamed. Chaining the method renames both division to state and managerName to managerFullName, without retaining the original column names.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!