What's the best way to summarize data by week? I have a set of timestamped records, and I want a report with one row for each week in the time period, including zero rows if there are weeks with no activity. I was planning to use ISO weeks because datetime has a convenient .isocalendar() method, but I want each output row to have a label like this:
2006 week 5 (Feb) However, to get the month (of the Thursday of that week) I have to convert it back to an actual date,and I don't see a method to do that in datetime or dateutil or mx.DateTime. I was planning to use a dateutil.rrule to generate the weeks from the minimum to maximum date, including any weeks that have no activity (so they won't be in the dictionary). But rrule sequences are based on an actual start date, not an ISO week, so that won't work. Unless perhaps I take the minimum date and calculate the Thursday of that week, and start from there. Then all my conversions would be to iso_week rather than from iso_week. Is there a better way to do this? --Mike -- http://mail.python.org/mailman/listinfo/python-list