Table Of Contents

Previous topic

Extensions to scikits.timeseries

Next topic


This Page

ReferencedSeries objects

class ReferencedSeries

Defines a TimeSeries object with a particular reference period.

The reference period consists simply of a starting date and an ending date. These dates do not have to be part of the series.

The reference period plays a role in statistical analysis. For example, it is customary in climate science to define anomalies as the deviations from the average calculated on a given reference period chosen for its representativity.

data : {array-like}

Data portion of the array. Any data that is valid for constructing a MaskedArray can be used here:

  • a sequence of objects (numbers, characters, objects);
  • a ndarray or one of its subclass. In particular, MaskedArray and TimeSeries are recognized.
dates : {DateArray}

A DateArray instance storing the date information.

mask : {nomask, sequence}, optional


refperiod : {None, tuple}, optional

Reference period, as a tuple (starting date, ending date). If None, the reference period is set to the whole range of dates.

freq : {None, string or integer}, optional

A valid frequency specification.

start_date : {None, Date}, optional

Starting date of the series. This parameter is only useful if dates is None.

dtype : {None, dtype}, optional.

Datatype of the series. If None, the dtype of data is used.

copy : {False, True}, optional

Whether copy the data (True) or just link to it (False).

autosort : {True, False}, optional

Whether to sort the series in chronological order.

**optional_parameters :

All the parameters recognized by MaskedArray are also recognized by TimeSeries.

See also

MaskedArray Support for missing values. TimeSeries Support for time/date indexed series


... specific to ReferencedSeries

Returns the reference period, as a DateArray. This attribute is writable. Setting the reference period to None will force the period to match the first and last dates (in chronological order).
Dictionary of optional information. This attribute is read-only. However, the different entries of the dictionary can be modified.

... inherited from TimeSeries


As a subclass of TimeSeries, a ReferencedSeries object inherits the methods of its parents. A short list is given below for convenience. Please refer to the documentation of the scikits.timeseries module for more information.

Methods inherited from MaskedArray

Handling the mask

The following methods can be used to access information about the mask or to manipulate the mask.


Counting the missing elements



To construct a ReferencedSeries object, the simplest method is to directly call the class constructor with the proper parameters.

However, the recommended way is to use the referenced_series factory function.

referenced_series(data, dates=None, start_date=None, freq=None, mask=False, refperiod=None, dtype=None, copy=False, fill_value=None, keep_mask=True, hard_mask=False)

Creates a ReferencedSeries object.


data : array_like

Data portion of the array. Any data that is valid for constructing a MaskedArray can be used here. May also be a TimeSeries object.

dates : {None, DateArray}, optional

A sequence of dates corresponding to each entry. If None, the dates will be constructed as a DateArray with the same length as data, starting at start_date with frequency freq.

start_date : {Date}, optional

Date corresponding to the first entry of the data (index 0). This parameter must be a valid Date object, and is mandatory if dates is None and if data has a length greater or equal to 1.

freq : {freq_spec}, optional

A valid frequency specification, as a string or an integer. This parameter is mandatory if dates is None.

refperiod : {None, tuple}, optional

Reference period of the object, as a tuple (starting date, ending date). If None, the reference period is set to the whole range of dates.


  • All other parameters that are accepted by the function in the module are also accepted by this function.