caikit.interfaces.ts.data_model.timeseries ========================================== .. py:module:: caikit.interfaces.ts.data_model.timeseries Attributes ---------- .. autoapisummary:: caikit.interfaces.ts.data_model.timeseries.log caikit.interfaces.ts.data_model.timeseries.error Classes ------- .. autoapisummary:: caikit.interfaces.ts.data_model.timeseries.TimeSeries Module Contents --------------- .. py:data:: log .. py:data:: error .. py:class:: TimeSeries(*args, **kwargs) Bases: :py:obj:`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. .. py:attribute:: timeseries :type: List[caikit.interfaces.ts.data_model._single_timeseries.SingleTimeSeries] .. py:attribute:: id_labels :type: List[str] .. py:attribute:: producer_id :type: caikit.core.data_model.ProducerId .. py:attribute:: _DEFAULT_ID_COL :value: '_TS_RESERVED' .. py:attribute:: _DEFAULT_TS_COL :value: 'timestamp' .. py:method:: __len__() -> int Return the length of the time series object. Returns: int: Length .. py:method:: __eq__(other: TimeSeries) -> bool Equivalence operator for TimeSeries objects. Args: other (TimeSeries): TimeSeries to test against. Returns: bool: True if the TimeSeries are equivalent. .. py:method:: _get_pd_df() -> Tuple[pandas.DataFrame, Iterable[str], str, Iterable[str]] Convert the data to a pandas DataFrame, efficiently if possible .. py:method:: as_pandas(include_timestamps: Optional[bool] = None, is_multi: Optional[bool] = None) -> pandas.DataFrame 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 .. py:method:: as_spark(include_timestamps: Optional[bool] = None, is_multi: Optional[bool] = None) -> caikit.interfaces.ts.data_model.toolkit.optional_dependencies.pyspark.sql.DataFrame 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