[Numpy-discussion] Overlapping time series

Daniele Nicolodi daniele at grinta.net
Tue Feb 11 08:47:19 EST 2014


On 11/02/2014 14:41, Andreas Hilboll wrote:
> On 11.02.2014 14:22, Daniele Nicolodi wrote:
>> On 11/02/2014 14:10, Andreas Hilboll wrote:
>>> On 11.02.2014 14:08, Daniele Nicolodi wrote:
>>>> Hello,
>>>>
>>>> I have two time series (2xN dimensional arrays) recorded on the same
>>>> time basis, but each with it's own dead times (and start and end
>>>> recording times).  I would like to obtain two time series containing
>>>> only the time overlapping segments of the data.
>>>>
>>>> Does numpy or scipy offer something that may help in this?
>>>>
>>>> I can imagine strategies about how to approach the problem, but none
>>>> that would be efficient.  Ideas?
>>>
>>> Take a look at pandas.  It has built-in time series functionality.
>>
>> Even using Pandas (and I would like to avoid to have to depend on it) it
>> is not clear to me how I would achieve what I want.  Am I missing something?
> 
> If the two time series are pandas.Series objects and are called s1 and s2:
> 
>     new1 = s1.ix[s2.dropna().index].dropna()
>     new2 = s2.ix[s1.dropna().index].dropna()
>     new1 = new1.ix[s2.dropna().index].dropna()
> 
> Looks hackish, so there might be a more elegant solution.  For further
> questions about how to use pandas, please look at the pydata mailing
> list or stackoverflow.

Correct me if I'm wrong, but this assumes that missing data points are
represented with Nan.  In my case missing data points are just missing.

Cheers,
Daniele




More information about the NumPy-Discussion mailing list