caikit.interfaces.ts.data_model.backends.util ============================================= .. py:module:: caikit.interfaces.ts.data_model.backends.util .. autoapi-nested-parse:: Internal utilities for supporting backend implementations Functions --------- .. autoapisummary:: caikit.interfaces.ts.data_model.backends.util.timezoneoffset caikit.interfaces.ts.data_model.backends.util.pd_timestamp_to_seconds caikit.interfaces.ts.data_model.backends.util.strip_periodic Module Contents --------------- .. py:function:: timezoneoffset(adatetime: datetime.datetime) -> int Returns the timezone offset (in seconds) for a given datetime object relative to the local system's time. Args: adatetime (datetime): a date of interest. Returns: int: offset in seconds (can be negative) .. py:function:: pd_timestamp_to_seconds(ts) -> float Extract the seconds-since-epoch representation of the timestamp NOTE: The pandas Timestamp.timestamp() function returns a different value than Timestamp.to_pydatetime().timestamp()! Since we want this to round-trip with python datetime, we want the latter. They both claim to be POSIX, so something is missing leap-something! .. py:function:: strip_periodic(input_df: pandas.DataFrame, ts_col_name: Union[str, None] = None, create_copy=True) -> pandas.DataFrame Removes **the first instance** of a periodic timestamp info (because spark doesn't like these when constructing a pyspark.sql.DataFrame.) If no periodic timestamp values can be found, input_df is returned as is. This method is always a no-op if input_df is not a native pandas.DataFrame.