Databricks Certified Associate Developer for Apache Spark 3.5 – Python Databricks-Certified-Associate-Developer-for-Apache-Spark-3.5 Question # 35 Topic 4 Discussion

Databricks Certified Associate Developer for Apache Spark 3.5 – Python Databricks-Certified-Associate-Developer-for-Apache-Spark-3.5 Question # 35 Topic 4 Discussion

Databricks-Certified-Associate-Developer-for-Apache-Spark-3.5 Exam Topic 4 Question 35 Discussion:
Question #: 35
Topic #: 4

25 of 55.

A Data Analyst is working on employees_df and needs to add a new column where a 10% tax is calculated on the salary.

Additionally, the DataFrame contains the column age, which is not needed.

Which code fragment adds the tax column and removes the age column?


A.

employees_df = employees_df.withColumn("tax", col("salary") * 0.1).drop("age")


B.

employees_df = employees_df.withColumn("tax", lit(0.1)).drop("age")


C.

employees_df = employees_df.dropField("age").withColumn("tax", col("salary") * 0.1)


D.

employees_df = employees_df.withColumn("tax", col("salary") + 0.1).drop("age")


Get Premium Databricks-Certified-Associate-Developer-for-Apache-Spark-3.5 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.