arthurai.util.generate_timestamps#

arthurai.util.generate_timestamps(total, duration='7d', end='now', freq='D', noisiness=0.3)#

Generates timestamps over a period of time, defaulting to daily timestamps over the last week. Creates uniques unique timestamp values evenly spaced between start and end inclusively. Repeats values if total ≠ uniques. This is useful for generating timestamps for test inferences outside of a production setting.

Parameters
  • total (int) – the total number of timestamps to generate

  • end (Union[str, datetime]) – the final timestamp value

  • duration (Union[str, timedelta]) – the difference between the first and last timestamp values. day or hour strings (e.g. “7d”, “4h”) and timedelta objects are supported

  • freq (Union[str, DateOffset]) – the frequency with which to generate unique values. See Pandas Offset Aliases for values

  • noisiness (float) – how much to noise to add to the number of timestamps repeated at each interval. specifically, the coefficient of variation (standard deviation / mean) to use when selecting the number of times to repeat each timestamp

Raises

UserValueError – if an input is invalid or values contain future timestamps and allow_future is False

Return type

List[datetime]

Returns

a list of generated timestamps