Câu 14: Databricks Certified Associate Developer for Apache Spark
Which of the following code blocks returns a DataFrame containing a column dayOfYear, an integer representation of the day of the year from column openDate from DataFrame storesDF?Note that column openDate is of type integer and represents a date in the UNIX epoch format – the number of seconds since midnight on Janua…
Nội dung câu hỏi
Which of the following code blocks returns a DataFrame containing a column dayOfYear, an integer representation of the day of the year from column openDate from DataFrame storesDF?Note that column openDate is of type integer and represents a date in the UNIX epoch format – the number of seconds since midnight on January 1st, 1970. A sample of storesDF is displayed below:
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. (storesDF.withColumn("openTimestamp", col("openDate").cast("Timestamp")). withColumn("dayOfYear", dayofyear(col("openTimestamp")))) — đáp án hiện tại
- B. storesDF.withColumn("dayOfYear", get dayofyear(col("openDate")))
- C. storesDF.withColumn("dayOfYear", dayofyear(col("openDate")))
- D. (storesDF.withColumn("openDateFormat", col("openDate").cast("Date")). withColumn("dayOfYear", dayofyear(col("openDateFormat"))))
- E. storesDF.withColumn("dayOfYear", substr(col("openDate"), 4, 6))
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.