79472819

Date: 2025-02-27 13:28:30
Score: 0.5
Natty:
Report link

You can just group by the yearweek column and then calculate the minimum and maximum dates for each group.

result = df.groupBy("yearweek").agg(
    min("date").alias("first_day_of_week"),
    max("date").alias("last_day_of_week")
)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Ali BOUHLEL