Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this exam
Question 67

The code block shown below should return a new DataFrame from DataFrame storesDF where column storeId is of the type string. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

storesDF.__1__("storeId", __2__("storeId").__3__(__4__)

    Correct Answer: A

    To create a new DataFrame where the storeId column is cast to a string type, we use the withColumn method of DataFrame to create or replace a column. The col function selects the column, and the cast method is used to change its type. Finally, StringType() specifies the target data type.

Discussion
Sowwy1Option: A

should be A