arthurai.util.format_time_series_attr_timestamps#
- arthurai.util.format_time_series_attr_timestamps(inference, time_series_attributes, tz=None, is_reference_data=False)#
Formats time series timestamps in json inference to ISO8601 conventions.
If a passed time series attribute is missing or the attribute is missing a timestamp field it will be skipped without raising an error.
- Parameters
inference (
Dict
[str
,Any
]) – Single inference from input to send_inferences() function or output from nest_reference_data() function. This enforces requirement that the inference has an “inference_data” or “reference_data” field.time_series_attributes (
List
[str
]) – List of names of attributes of the model of time series value typetz (
Union
[timezone
,str
,None
]) – datetime timezone object or timezone stringis_reference_data (
bool
) – True if reformatting reference data, False if reformatting inference data
- Return type
Dict
[str
,Any
]- Returns
updated json inference_data or reference_data field
- Raises
TypeError – timestamp is not of type datetime.datetime
ValueError – timestamp is not timezone aware and no location data is provided to remedy or inference does not match expected formatting