0

which week in the year does this function return? Why is the return of 2019.12.31 the first week? I have checked this function in dolphindb-help, and it says that "weekOfYear(X): For each element in X, return a number indicating which week of the year it falls in. Each week starts on Monday." So I think it is not right for the date 12.31 to return 1 right?

Ken White
  • 123,280
  • 14
  • 225
  • 444
Polly
  • 603
  • 3
  • 13

1 Answers1

1

The weekOfYear in dolphindb is consistent with the rule of weekofyear in pandas, and the specific rules are as follows:

If December 31st falls on a Monday, Tuesday or Wednesday, it returns as week 01 of the next year; If it falls on a Thursday, it returns as week 53 of the year just ended; If it falls on a Friday, it returns as week 52 (or week 53 if the year just ended is a leap year); If it falls on a Saturday or Sunday, it returns as week 52 of the year just ended.

jinwandalaohu
  • 226
  • 1
  • 7