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


Groups > comp.lang.python > #50011

Re: analyzing time

From Neil Cerutti <neilc@norwich.edu>
Newsgroups comp.lang.python
Subject Re: analyzing time
Date 2013-07-05 19:35 +0000
Organization Norwich University
Message-ID <b3olg5F2k73U1@mid.individual.net> (permalink)
References <2aa041fe-8226-4fb9-9ce6-b1eb48a19e4d@googlegroups.com>

Show all headers | 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