On 7/5/2013 3:18 PM, noydb wrote:

I have a table with a column of type date, with dates and time

This is a datetime in Python parlance.

combined (like '1/6/2013 3:52:69PM'), that spans many months.  How
would I pull out records that are the first and last entries per
day?

Sort on that column. Look at pairs of rows. If the days differ, you have the last of the first and the first of the second. One way:

it = <table iterator>
dt1 = next(it)
d1 = date(dt1)  # whatever that looks like

for row in it:
  dt2 = row
  d2 = date(dt2)
  if d1 != d2:
    do_whatever(dt1, dt2)
  dt1, d1 = dt2, d2

Also, if I wanted to find time clusters per day (or per week) -- like
if an entry is made every day around 11am -- is there a way to get at
that temporal statistical cluster?

Make a histogram of time, ignoring date.

Python 2.7, Windows 7.

Any guidance would be greatly appreciated!  Time seems tricky...

Yes

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to