caikit.interfaces.ts.data_model.backends.pandas_backends ======================================================== .. py:module:: caikit.interfaces.ts.data_model.backends.pandas_backends .. autoapi-nested-parse:: Core data model backends backed by pandas Attributes ---------- .. autoapisummary:: caikit.interfaces.ts.data_model.backends.pandas_backends.log caikit.interfaces.ts.data_model.backends.pandas_backends.error Classes ------- .. autoapisummary:: caikit.interfaces.ts.data_model.backends.pandas_backends.PandasMultiTimeSeriesBackend caikit.interfaces.ts.data_model.backends.pandas_backends.PandasTimeSeriesBackend caikit.interfaces.ts.data_model.backends.pandas_backends.PandasValueSequenceBackend caikit.interfaces.ts.data_model.backends.pandas_backends.PandasPeriodicTimeSequenceBackend caikit.interfaces.ts.data_model.backends.pandas_backends.PandasPointTimeSequenceBackend caikit.interfaces.ts.data_model.backends.pandas_backends.PandasTimePointBackend Module Contents --------------- .. py:data:: log .. py:data:: error .. py:class:: PandasMultiTimeSeriesBackend(data_frame: pandas.DataFrame, key_column: Union[Iterable[str], str], timestamp_column: Optional[str] = None, value_columns: Optional[Iterable[str]] = None, ids: Optional[Union[Iterable[int], Iterable[str]]] = None, producer_id: Optional[Union[Tuple[str, str], caikit.core.data_model.ProducerId]] = None) Bases: :py:obj:`caikit.interfaces.ts.data_model.backends.base.MultiTimeSeriesBackendBase` Abstract base class for all backends of the central MultiTimeSeries data model type .. py:method:: as_pandas() -> Tuple[pandas.DataFrame, Iterable[str], str, Iterable[str]] 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 .. py:attribute:: _df .. py:attribute:: _key_column .. py:attribute:: _timestamp_column :value: None .. py:attribute:: _value_columns .. py:attribute:: _ids :value: [] .. py:attribute:: _producer_id .. py:attribute:: _timeseries :value: None .. py:attribute:: _key_columns .. py:method:: get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.timeseries.TimeSeries], name: str) -> Any 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. .. py:class:: PandasTimeSeriesBackend(data_frame: pandas.DataFrame, timestamp_column: str = None, value_columns: Optional[Iterable[str]] = None, ids: Optional[Union[Iterable[int], Iterable[str]]] = None) Bases: :py:obj:`caikit.interfaces.ts.data_model.backends.base.TimeSeriesBackendBase` The PandasTimeSeriesBackend is responsible for managing the standard in-memory representation of a TimeSeries .. py:attribute:: _df .. py:attribute:: _timestamp_column :value: None .. py:attribute:: _value_columns .. py:attribute:: _ids :value: [] .. py:method:: get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.SingleTimeSeries], name: str, external_df: pandas.DataFrame = None) -> Any When fetching a data attribute from the timeseries, this aliases to the appropriate set of backend wrappers for the various fields. .. py:method:: as_pandas() -> Tuple[pandas.DataFrame, str, Iterable[str]] Return the underlying data frame .. py:class:: PandasValueSequenceBackend(data_frame: pandas.Series, col_name: str) Bases: :py:obj:`caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin`, :py:obj:`caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin` Backend for ValueSequence backed by a set of columns in a Pandas DataFrame .. py:method:: _serialize_any(any_val) :staticmethod: .. py:attribute:: _TIMESTAMP_DTYPE .. py:attribute:: _DEFAULT_VECTOR_TYPES .. py:attribute:: _df .. py:attribute:: _col_name .. py:attribute:: _dtype .. py:attribute:: _converter .. py:method:: get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.ValueSequence], name: str) -> Any Get the known attributes from the underlying DataFrame columns .. py:class:: PandasPeriodicTimeSequenceBackend(time_sequence) Bases: :py:obj:`caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin`, :py:obj:`caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin` Backend for PeriodicTimeSequence backed by a Pandas Time Span .. py:attribute:: _is_range_index .. py:method:: get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.PeriodicTimeSequence], name: str) -> Any Get the known attributes from the backend data .. py:class:: PandasPointTimeSequenceBackend(time_sequence: pandas.Series) Bases: :py:obj:`caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin`, :py:obj:`caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin` Backend for PointTimeSequence backed by a Pandas Series .. py:attribute:: _time_sequence .. py:method:: get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.PointTimeSequence], name: str) -> Any Get the known attributes from the backend data .. py:class:: PandasTimePointBackend(point_data: Any) Bases: :py:obj:`caikit.interfaces.ts.data_model.backends.base.UncachedBackendMixin`, :py:obj:`caikit.interfaces.ts.data_model.backends.base.StrictFieldBackendMixin` Backend for time point data held by Pandas .. py:attribute:: _point_data .. py:method:: get_attribute(data_model_class: Type[caikit.interfaces.ts.data_model.time_types.TimePoint], name: str) -> Any Get the appropriate fields based on the data type of the point