DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #4
Which of the following code blocks returns a new DataFrame with a new column employeesPerSqft that is the quotient of column numberOfEmployees and column sqft, both of which are from DataFrame storesD
Sign in or unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK to reveal the answer and full explanation for question #4. The question stem and answer options stay visible for context.
Question
Which of the following code blocks returns a new DataFrame with a new column employeesPerSqft that is the quotient of column numberOfEmployees and column sqft, both of which are from DataFrame storesDF? Note that column employeesPerSqft is not in the original DataFrame storesDF.
Options
- AstoresDF.withColumn("employeesPerSqft", col("numberOfEmployees") / col("sqft"))
- BstoresDF.withColumn("employeesPerSqft", "numberOfEmployees" / "sqft")
- CstoresDF.select("employeesPerSqft", "numberOfEmployees" / "sqft")
- DstoresDF.select("employeesPerSqft", col("numberOfEmployees") / col("sqft"))
- EstoresDF.withColumn(col("employeesPerSqft"), col("numberOfEmployees") / col("sqft"))
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.