Mismatch of week_start_date and weekofyear?

There are some records whose week_start_date are yyyy-01-01 but weekofyear are set 52 or 53.

city,year,weekofyear, week_start_date
sj, 1993, 53, 1993-01-01
sj, 1994, 52, 1994-01-01
sj, 1995, 52, 1995-01-01

Therefore, (a) the data sorted by (year and weekofyear) pair, and (b) the data sorted by (week_start_date) have different order.
Can I assumes that the data sorted by (week_start_date) have right order?


Yes, the problem is that drivendata decided to use the year of the date that week_start_date represents. The example is 1993-01-01 the answer is 1993. However, the week number originates from the week based year, which - depending on the representation, e.g., ISO 8601, the week based year is 1992. See https://en.wikipedia.org/wiki/ISO_week_date for more details.

Thank you for your reply.

On the page I could find the rule:

Weeks start with Monday. Each week’s year is the Gregorian year in which the Thursday falls.

The concept of “week of year” is more complicated than I first thought!
I learned that there are lots of things to learn :slight_smile:.

so do we manually go fix this in the data? or we can do without it?