Time Series

This class represents a univariate time series. It allows for the storage of time indexed values as well as metadata. The constructor guarantees the monotonic increasing character of a time series.

Warning

The aim of a TimeSeries object is to be immutable

Constructor

TimeSeries(series, …)

A TimeSeries object is a series of time indexed values.

Methods

create(start, end[, freq, metadata])

Creates an empty TimeSeries object with the period as index

plot(*args, **kwargs)

Plot a TimeSeries

copy([deep])

Copy a TimeSeries

split_at(timestamp)

Split a TimeSeries at a defined point and include the splitting point in both as in [start,…,at] and [at,…,end].

split_in_chunks(n)

Split a TimeSeries into chunks of length n

fill(value)

Fill a TimeSeries with values

empty()

Empty the TimeSeries (fill all values with NaNs)

pad(limit[, side, value])

Pad a TimeSeries until a given limit

trim([side])

Remove NaNs from a TimeSeries start, end or both

merge(ts)

Merge two time series and make sure all the given indexes are sorted.

Processing

apply(func[, ts])

Wrapper around the Pandas apply function

resample(freq[, method])

Convert TimeSeries to specified frequency.

group_by(freq[, method])

Groups values by a frequency.

interpolate(*args, **kwargs)

Wrapper around the Pandas interpolate() method.

normalize(method)

Normalize a TimeSeries with a given method

round(decimals)

Round the values in the series.values

sort(*args, **kwargs)

Sort a TimeSeries by time stamps

Analysis

min()

Get the minimum value of a TimeSeries

max()

Get the maximum value of a TimeSeries

mean()

Get the mean value of a TimeSeries

median()

Get the median value of a TimeSeries

skewness()

Get the skewness of a TimeSeries

kurtosis()

Get the kurtosis of a TimeSeries

describe([percentiles, include, exclude])

Describe a TimeSeries with the describe function from Pandas

start()

Get the first Timestamp of a TimeSeries

end()

Get the last Timestamp of a TimeSeries

boundaries()

Get a tuple with the TimeSeries first and last index

frequency()

Get the frequency of a TimeSeries

duration()

Get the duration of the TimeSeries

I/O

to_text(path)

Export a TimeSeries to text format

to_array()

Convert a TimeSeries to Numpy Array

to_pickle(path)

Export a TimeSeries to Pickle

to_darts()

Convert a TimeSeries to Darts TimeSeries

to_df()

Converts a TimeSeries to a Pandas DataFrame