caikit.interfaces.ts.data_model.timeseries

Attributes

log

error

Classes

TimeSeries

A DataObject is a data model class that is backed by a @dataclass.

Module Contents

caikit.interfaces.ts.data_model.timeseries.log[source]
caikit.interfaces.ts.data_model.timeseries.error
class caikit.interfaces.ts.data_model.timeseries.TimeSeries(*args, **kwargs)[source]

Bases: caikit.core.DataObjectBase

A DataObject is a data model class that is backed by a @dataclass.

Data model classes that use the @dataobject decorator must derive from this base class.

timeseries: List[caikit.interfaces.ts.data_model._single_timeseries.SingleTimeSeries]
id_labels: List[str]
producer_id: caikit.core.data_model.ProducerId
_DEFAULT_ID_COL = '_TS_RESERVED'
_DEFAULT_TS_COL = 'timestamp'
__len__() int[source]

Return the length of the time series object.

Returns:

int: Length

__eq__(other: TimeSeries) bool[source]

Equivalence operator for TimeSeries objects.

Args:

other (TimeSeries): TimeSeries to test against.

Returns:

bool: True if the TimeSeries are equivalent.

_get_pd_df() Tuple[pandas.DataFrame, Iterable[str], str, Iterable[str]][source]

Convert the data to a pandas DataFrame, efficiently if possible

as_pandas(include_timestamps: bool | None = None, is_multi: bool | None = None) pandas.DataFrame[source]

Get the view of this timeseries as a pandas DataFrame

Args:

include_timestamps (bool, optional): Control the addition or removal of timestamps. True will include timestamps, generating if needed, while False will remove timestamps. Use None to returned what is available, leaving unchanged. Defaults to None.

is_multi (bool, optional): Controls how id_labels are handled in the output. If the id_labels are specified in the data model, they are always returned. If there are no id_labels specified, setting is_multi to True will add a new column with generated id labels (0), while False or None will not add any id_labels.

Returns:

pd.DataFrame: The view of the data as a pandas DataFrame

as_spark(include_timestamps: bool | None = None, is_multi: bool | None = None) caikit.interfaces.ts.data_model.toolkit.optional_dependencies.pyspark.sql.DataFrame[source]

Get the view of this timeseries as a spark DataFrame

Args:

include_timestamps (bool, optional): Control the addition or removal of timestamps. True will include timestamps, generating if needed, while False will remove timestamps. Use None to returned what is available, leaving unchanged. Defaults to None.

is_multi (bool, optional): Controls how id_labels are handled in the output. If the id_labels are specified in the data model, they are always returned. If there are no id_labels specified, setting is_multi to True will add a new column with generated id labels (0), while False or None will not add any id_labels.

Returns:

pyspark.sql.DataFrame: The view of the data as a spark DataFrame