Function Repository Resource:

ConformTimeSeries

Source Notebook

Conform a list of time series to a shared date or time range

Contributed by: Arnoud Buzing

ResourceFunction["ConformTimeSeries"][{ts1,ts2,}]

conforms the given time series tsi to a shared date or time range.

Examples

Basic Examples (4) 

Create a simple time series with a start date of today:

In[1]:=
ts1 = TimeSeries[
  Transpose[{
    DateRange[Today, Today + Quantity[9, "Days"]],
    RandomInteger[{0, 99}, 10]
    }]]
Out[1]=

Create another time series, but starting tomorrow:

In[2]:=
ts2 = TimeSeries[
  Transpose[{
    DateRange[Tomorrow, Tomorrow + Quantity[9, "Days"]],
    RandomInteger[{0, 99}, 10]
    }]]
Out[2]=

ConformTimeSeries takes the given list of time series and clips off any times or dates that are not common to all:

In[3]:=
cts = ResourceFunction["ConformTimeSeries"][{ts1, ts2}]
Out[3]=

ConformTimeSeries can be useful when one or more time series have outlying times or dates:

In[4]:=
{DateListPlot[{ts1, ts2}], DateListPlot[cts]}
Out[4]=

Publisher

Arnoud Buzing

Version History

  • 1.0.0 – 18 March 2022

Related Resources

License Information