Databricks
DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #3
Which of the following code blocks returns a new DataFrame from DataFrame storesDF where column storeId is of the type string?
Sign in or unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK to reveal the answer and full explanation for question #3. The question stem and answer options stay visible for context.
Working with Spark DataFrames and Transformations
Question
Which of the following code blocks returns a new DataFrame from DataFrame storesDF where column storeId is of the type string?
Options
- AstoresDF.withColumn("storeId, cast(col("storeId"), StringType()))
- BstoresDF.withColumn("storeId, col("storeId").cast(StringType()))
- CstoresDF.withColumn("storeId, cast(storeId).as(StringType)
- DstoresDF.withColumn("storeId, col(storeId).cast(StringType)
- EstoresDF.withColumn("storeId, cast("storeId").as(StringType()))
Unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK to see the answer
You've previewed enough free DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK questions. Unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#DataFrame Transformations#Type Casting#PySpark API#withColumn