caikit.interfaces.ts.data_model.backends.pandas_backends

Core data model backends backed by pandas

Attributes

log

error

Classes

PandasMultiTimeSeriesBackend

Abstract base class for all backends of the central MultiTimeSeries data model

PandasTimeSeriesBackend

The PandasTimeSeriesBackend is responsible for managing the standard

PandasValueSequenceBackend

Backend for ValueSequence backed by a set of columns in a Pandas

PandasPeriodicTimeSequenceBackend

Backend for PeriodicTimeSequence backed by a Pandas Time Span

PandasPointTimeSequenceBackend

Backend for PointTimeSequence backed by a Pandas Series

PandasTimePointBackend

Backend for time point data held by Pandas

Module Contents

caikit.interfaces.ts.data_model.backends.pandas_backends.log[source]
caikit.interfaces.ts.data_model.backends.pandas_backends.error
class caikit.interfaces.ts.data_model.backends.pandas_backends.PandasMultiTimeSeriesBackend(data_frame: pandas.DataFrame, key_column: Iterable[str] | str, timestamp_column: str | None = None, value_columns: Iterable[str] | None = None, ids: Iterable[int] | Iterable[str] | None = None, producer_id: Tuple[str, str] | caikit.core.data_model.ProducerId | None = None)[source]

Bases: caikit.interfaces.ts.data_model.backends.base.MultiTimeSeriesBackendBase

Abstract base class for all backends of the central MultiTimeSeries data model type

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

All backends must implement the ability to coerce their underlying data into a pandas DataFrame and provide the pointers to the timeseries source and value source(s)

Returns:
df: pd.DataFrame

The data frame itself

key_source: Iterable[str]

the names of the columns holding key values

timestamp_source: str

The column name (or None) indicating where the timestamp sequence can be found

value_source: Iterable[str]

The names of the columns holding value sequences

_df
_key_column
_timestamp_column = None
_value_columns
_ids = []
_producer_id
_timeseries = None
_key_columns
get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.timeseries.TimeSeries], name: str) Any[source]

A data model backend must implement this in order to provide the frontend view the functionality needed to lazily extract data.

Args:
data_model_class (Type[DataBase]): The frontend data model class

that is accessing this attribute

name (str): The name of the attribute to access

Returns:
value: Union[Any, OneofFieldVal]

The extracted attribute value or a OneofFieldVal that wraps the field val with an indicator about the oneof field that is set.

class caikit.interfaces.ts.data_model.backends.pandas_backends.PandasTimeSeriesBackend(data_frame: pandas.DataFrame, timestamp_column: str = None, value_columns: Iterable[str] | None = None, ids: Iterable[int] | Iterable[str] | None = None)[source]

Bases: caikit.interfaces.ts.data_model.backends.base.TimeSeriesBackendBase

The PandasTimeSeriesBackend is responsible for managing the standard in-memory representation of a TimeSeries

_df
_timestamp_column = None
_value_columns
_ids = []
get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.SingleTimeSeries], name: str, external_df: pandas.DataFrame = None) Any[source]

When fetching a data attribute from the timeseries, this aliases to the appropriate set of backend wrappers for the various fields.

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

Return the underlying data frame

class caikit.interfaces.ts.data_model.backends.pandas_backends.PandasValueSequenceBackend(data_frame: pandas.Series, col_name: str)[source]

Bases: caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin, caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin

Backend for ValueSequence backed by a set of columns in a Pandas DataFrame

static _serialize_any(any_val)[source]
_TIMESTAMP_DTYPE
_DEFAULT_VECTOR_TYPES
_df
_col_name
_dtype
_converter
get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.ValueSequence], name: str) Any[source]

Get the known attributes from the underlying DataFrame columns

class caikit.interfaces.ts.data_model.backends.pandas_backends.PandasPeriodicTimeSequenceBackend(time_sequence)[source]

Bases: caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin, caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin

Backend for PeriodicTimeSequence backed by a Pandas Time Span

_is_range_index
get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.PeriodicTimeSequence], name: str) Any[source]

Get the known attributes from the backend data

class caikit.interfaces.ts.data_model.backends.pandas_backends.PandasPointTimeSequenceBackend(time_sequence: pandas.Series)[source]

Bases: caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin, caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin

Backend for PointTimeSequence backed by a Pandas Series

_time_sequence
get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.PointTimeSequence], name: str) Any[source]

Get the known attributes from the backend data

class caikit.interfaces.ts.data_model.backends.pandas_backends.PandasTimePointBackend(point_data: Any)[source]

Bases: caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin, caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin

Backend for time point data held by Pandas

_point_data
get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.TimePoint], name: str) Any[source]

Get the appropriate fields based on the data type of the point