[SciPy-User] scikits.timeseries concatenate

Dave Hirschfeld dave.hirschfeld@gmail....
Fri Nov 13 03:14:26 CST 2009


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




More information about the SciPy-User mailing list