Ultimate access to all questions.
Which of the following code blocks returns a DataFrame containing a column "month" and an integer representation of the day of the year from column "openDate" in DataFrame "storesDF", where "openDate" is of type integer representing a UNIX epoch timestamp (seconds since 1970-01-01)?
A sample of storesDF is shown below:
storeId openDate 0 1100746394 1 1474410343 2 1116610009 3 1180035265 4 1408024997
Question Code block:
storesDF.withColumn("openTimestamp", col("openDate").cast("timestamp")) .withColumn("month", month(col("openTimestamp"))) .withColumn("day_of_year", dayofyear(col("openTimestamp")))