MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to split a daily DateList by week? --> Solved

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114865] How to split a daily DateList by week? --> Solved
  • From: "Sohn Hyun-U" <hsohn at student.ethz.ch>
  • Date: Tue, 21 Dec 2010 00:17:06 -0500 (EST)

Hi there,

I just found a better solution:

Given a DateList ts, one can split it by calendar months simply using

SplitBy[ts, #[[1, {1, 2}]] &]

instead of my crummy first try.

To split by week, I found a function ISOWeek right in this group (https://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/3dbc03f1f113b370/18e87e147589ebfe?hl=bn&lnk=gst&q=week#18e87e147589ebfe), which can then be used analogously like

SplitBy[ts, #[[1, 1]] && ISOWeek[#[[1]]] &]

This kind of stuff makes me love Mathematica! :-)

Thanks to Hans Michel!

Kind regards,
Hyun-U Sohn


  • Prev by Date: Re: "Accumulate" with operator Times.
  • Next by Date: Factorization with respect to Quaternions
  • Previous by thread: How to split a daily DateList by week? --> Solved
  • Next by thread: Factorization with respect to Quaternions