scikits.timeseries concatenate

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

scikits.timeseries concatenate

dhirschfeld

It appears that when remove_duplicates is True (the default) ts.concatenate
doesn't respect the dimensions of the data array c.f.

In [1]: ts1 =
ts.time_series(array([[1,2]]).repeat(10,axis=0),
               start_date=ts.Date('D','01-Jan-2009'))

In [2]: ts2 =
ts.time_series(array([[3,4]]).repeat(10,axis=0),
               start_date=ts.Date('D','11-Jan-2009'))

In [3]: ts.concatenate([ts1,ts2],axis=0,remove_duplicates=False)
Out[3]:
timeseries(
 [[1 2]
 [1 2]
 [1 2]
 [1 2]
 [1 2]
 [1 2]
 [1 2]
 [1 2]
 [1 2]
 [1 2]
 [3 4]
 [3 4]
 [3 4]
 [3 4]
 [3 4]
 [3 4]
 [3 4]
 [3 4]
 [3 4]
 [3 4]],
    dates =
 [01-Jan-2009 ... 20-Jan-2009],
    freq  = D)

In [4]: ts.concatenate([ts1,ts2],axis=0)
Out[4]:
timeseries([1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2],
   dates = [01-Jan-2009 ... 20-Jan-2009],
   freq  = D)

?!?

I think the fix is to pass the axis parameter as follows:

        result = ts.time_series(ndata.compress(orig,axis=axis),
                             dates=ndates.compress(orig),freq=common_f)

I haven't had time to test this thoroughly (execpt that it works for me) but
thought I'd post it before the next bug-fix release got out.

HTH,
Dave


_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: scikits.timeseries concatenate

Pierre GM-2

On Nov 13, 2009, at 4:14 AM, Dave Hirschfeld wrote:

>
> It appears that when remove_duplicates is True (the default) ts.concatenate
> doesn't respect the dimensions of the data array c.f.

Good call, and thanks for the fix. I gonna investigate some more and let you know...
_______________________________________________
SciPy-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/scipy-user