Databricks Certified Data Engineer - Associate

Databricks Certified Data Engineer - Associate

Get started today

Ultimate access to all questions.


You have a DataFrame df with a column transaction_date in timestamp format. How would you extract the year from this timestamp using Spark? Provide the code snippet.




Explanation:

The correct answer is A because it correctly uses the year function to extract the year from the transaction_date column and adds it as a new column 'year'.