Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50011

Re: analyzing time

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Neil Cerutti <neilc@norwich.edu>
Newsgroups comp.lang.python
Subject Re: analyzing time
Date 5 Jul 2013 19:35:33 GMT
Organization Norwich University
Lines 31
Message-ID <b3olg5F2k73U1@mid.individual.net> (permalink)
References <2aa041fe-8226-4fb9-9ce6-b1eb48a19e4d@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace individual.net 4z9s8GrNkDlyqY4cnEvlsQ4BWVM9vm21TeHDa/ZH9yBPtY9wMu
Cancel-Lock sha1:RNMt+QzHpMbTZp5CvLC/LEh1tFY=
User-Agent slrn/0.9.9p1/mm/ao (Win32)
Xref csiph.com comp.lang.python:50011

Show key headers only | View raw


On 2013-07-05, noydb <jenn.duerr@gmail.com> wrote:
> Hello All,
>
> I have a table with a column of type date, with dates and time
> 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?
>
> 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?
>
> Python 2.7, Windows 7.
>
> Any guidance would be greatly appreciated!  Time seems tricky...

Time *is* really tricky, but that's because we humans created a
tricky system. If can ignore issues of timespampts, timezones and
daylight savings time, then time handling in Python can be
simple.

datetime.datetime.strptime can translate the time format above
into datetime.datetime objects, which provide all the methods you
will need.

To find clusters and min and max values you will likely need to
put the datetime objects in a list, and use some Python builtins
and list methods.

-- 
Neil Cerutti

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

analyzing time noydb <jenn.duerr@gmail.com> - 2013-07-05 12:18 -0700
  Re: analyzing time Neil Cerutti <neilc@norwich.edu> - 2013-07-05 19:35 +0000
  Re: analyzing time Skip Montanaro <skip@pobox.com> - 2013-07-05 14:43 -0500
  Re: analyzing time Gary Herron <gherron@digipen.edu> - 2013-07-05 12:47 -0700
  Re: analyzing time Terry Reedy <tjreedy@udel.edu> - 2013-07-05 15:54 -0400

csiph-web