[SciPy-User] Extract datetime range values from numpy array
Mon Sep 19 11:19:05 CDT 2011
I have numpy array like this:
Out dtype=[('dt', '|O8'), ('value', '<f8')]
array object named 'dt' is python datetime object like [2010-12-31
11:30:00, 2010-12-31 12:00:00, ...] so it's sampled data on every half hour
for whole year.
I'm wondering how to easily extract some information pattern, for example:
1. print September values at 12:00
2. print September values from 10:00 to 14:00
I mean, I can do something like:
for i in ndata.dt:
if i.time() == datetime.time(12, 00): print i
but apart from it does not look to me as right approach, I can't figure out
how to reference 'value' object data that corresponds to certain 'dt'
If it's not clear, let's say in Python you can call dictionary object data
by key or value, then additionally slice it depending of dictionary objects
types - how to do the same with numpy array? I guess this is basic and I
have numpy reference file, but can't seem to find what I'm looking for.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User