[SciPy-User] Joining 1D Timeseries to create a nD Timeseries

Pierre GM pgmdevlist@gmail....
Sun Apr 11 13:17:12 CDT 2010


On Apr 11, 2010, at 1:50 PM, Sergi Pons Freixes wrote:
> Is there any elegant and fast way to join multiple unidimensional
> timeseries to create a new one? E.g:
> 
> ts1 = timeseries 1D with param1
> ts2 = timeseries 2D with param2
> (ts1 and ts2 have same Date array)
> 
> newts = join_ts(ts1, ts2) ---> newts= timeseries 2D with param2, param2

ts.stack should do the trick.

> 
> Or can this only be accomplished by creating a new timeseries, and
> manually setting the date array and all the data at the creation time?

Or you could try
ts.time_series(np.column_stack(*yourseries),dates=your_first_series.dates)
provided that you checked your series have the same dates and that there's no missing values. If the second condition is not met, use np.ma.column_stack instead (so that you don't lose the mask).





More information about the SciPy-User mailing list