caikit.interfaces.ts.data_model.backends.util
Internal utilities for supporting backend implementations
Functions
|
Returns the timezone offset (in seconds) |
|
Extract the seconds-since-epoch representation of the timestamp |
|
Removes the first instance of a periodic timestamp info |
Module Contents
- caikit.interfaces.ts.data_model.backends.util.timezoneoffset(adatetime: datetime.datetime) int[source]
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)
- caikit.interfaces.ts.data_model.backends.util.pd_timestamp_to_seconds(ts) float[source]
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!
- caikit.interfaces.ts.data_model.backends.util.strip_periodic(input_df: pandas.DataFrame, ts_col_name: str | None = None, create_copy=True) pandas.DataFrame[source]
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.