Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    what is your epoch? and also, what is your definition of "week"? just seven days, iso-week, ...? Commented Jan 21, 2021 at 18:21
  • Data goes back five years. So any epoch earlier than that is okay. How the weeks is defined? Hmm. I haven't thought deeply about that, but assumed that there is a convention used in the standard libraries as there are provided methods to obtain it in context of the year @MrFuppes (I would choose Monday through Sunday, if given a choice) Commented Jan 21, 2021 at 18:25
  • I have a potential solution. Pandas has a period constants with which to generate date ranges. Among them are week starting by day n like Monday. I can generate a date range from epoch using his period, search for where in that range my datetime belongs, and use the position in the array. I wish there was a more direct solution @MrFuppes Commented Jan 21, 2021 at 18:37