[SciPy-User] find particular day_of_week
Wed Jan 27 15:37:46 CST 2010
On Jan 27, 2010, at 2:25 PM, email@example.com wrote:
> On Wed, Jan 27, 2010 at 4:18 PM, Robert Ferrell <firstname.lastname@example.org
> > wrote:
>> I have a time series, I want to operate (read only) on all the items
>> with a particular day_of_week. What is an efficient way to get at
>> I've tried:
>> desiredDates = [dt for dt in myTS.dates if
>> dt.day_of_week ==
>> desiredSeries = myTS[desiredDates]
>> but that seems quite slow. The second line is the one which is
>> all the time. Is there a faster way? I don't need a copy, just a
>> view, if that helps.
> I think numpy-discussion jan 20th "dates, np.where finding months"
> answers this.
You're right, of course. I thought this sounded familiar, but I
couldn't think of the right search terms.
Luckily, I came up with a solution I like even better just after I
sent this email:
desiredSeries = myTS[myTS.day_of_week == day_of_week]
More information about the SciPy-User