Conversion of TimeSeries

... to other types

TimeSeries.__float__() Convert to float.
TimeSeries.__hex__() <==> hex(x)
TimeSeries.__int__() Convert to int.
TimeSeries.__long__() <==> long(x)
TimeSeries.__oct__() <==> oct(x)
TimeSeries.view([dtype, type])
TimeSeries.astype(newtype) Returns a copy of the MaskedArray cast to given newtype.
TimeSeries.byteswap(inplace) Swap the bytes of the array elements

... to other objects

TimeSeries.tofile(series, fileobject[, ...]) Writes the TimeSeries to a file.
TimeSeries.toflex() Transforms a TimeSeries into a structured array with three fields:.
TimeSeries.tolist() Returns the dates and data portion of the TimeSeries “zipped” up in a list of standard python objects (eg.
TimeSeries.torecords() Transforms a TimeSeries into a structured array with three fields:.
TimeSeries.tostring([fill_value, order]) This function is a compatibility alias for tobytes.

... to other frequencies

The following methods converts TimeSeries from one frequency to another.

TimeSeries.asfreq(freq[, relation]) Converts the dates portion of the TimeSeries to another frequency.
TimeSeries.convert(series, freq[, func, ...]) Converts a series from one frequency to another, by manipulating both the data and dates attributes.

Warning

Be careful not to confuse the two methods asfreq and convert.

  • asfreq simply takes every date in the dates attribute of the TimeSeries instance and changes it to the specified frequency, so the resulting series will have the same shape as the original series.
  • convert is a more complicated function that takes a series with no missing nor duplicated dates and creates a series at the new frequency with no missing nor duplicated dates and intelligently places the data from the original series into appropriate points in the new series.
convert(series, freq[, func, position]) Converts a series from one frequency to another, by manipulating both the data and dates attributes.
scikits.timeseries.extras.convert_to_annual(series) Group a series by years, taking leap years into account.