tspy.data_structures.io.MultiTimeSeriesWriter module

class tspy.data_structures.io.MultiTimeSeriesWriter.MultiTimeSeriesWriter(tsc, j_time_series_writer)

Bases: object

Builder pattern used for writing a time-series to an outside data-source

Notes

A time-series-writer has a few components:
  • observations: the in-memory observations to write to an outside data-source

  • options: key-value string pair in map of options to be used in writing

  • value-encoder: function to encode a value to a String, by default __str__ is used

  • key-encoder: function to encode a key to a String, by default __str__ is used

This class works as follows:
  • builds a blank time-series-writer that only contains observations

  • set options and value-encoder (optional)

  • save to data-source (using a multi-time-series-write-format) given options and value-encoder

Methods

encode_key(key_encoder)

set function to encode a value to a string when writing

encode_value(value_encoder)

set function to encode a value to a string when writing

object_file(path)

save as object-file

option(key, value)

set an option for this multi-time-series-writer

options(**kwargs)

set multiple options for this multi-time-series-writer

save(multi_time_series_write_format)

save to a user-defined multi-time-series-write-format

encode_key(key_encoder)

set function to encode a value to a string when writing

Parameters
key_encoderfunc

function to encode a key to a string when writing

Returns
MultiTimeSeriesWriter

this multi-time-series-writer

encode_value(value_encoder)

set function to encode a value to a string when writing

Parameters
value_encoderfunc

function to encode a value to a string when writing

Returns
TimeSeriesWriter

this time-series-writer

object_file(path)

save as object-file

Parameters
pathstr

file path to save to

option(key, value)

set an option for this multi-time-series-writer

Parameters
keystr

option key

valueAny

option value

Returns
MultiTimeSeriesWriter

this multi-time-series-writer

options(**kwargs)

set multiple options for this multi-time-series-writer

Parameters
kwargskey-value varargs

key-value options as varargs

Returns
MultiTimeSeriesWriter

this multi-time-series-writer

save(multi_time_series_write_format)

save to a user-defined multi-time-series-write-format

Parameters
multi_time_series_write_formatMultiTimeSeriesWriteFormat

the multi-time-series write format