Resample the covered duration.


number_or_interval (Union[int, TimedeltaIndex, Quantity, timedelta64, list[str], Time]) – If an integer is passed, the covered time period will be divided into equally sized time steps so that the total number of time steps is equal to the passed number. If a timedelta is passed, the whole period will be resampled so that the difference between all time steps matches the timedelta. Note that the boundaries of the time period will not change. Therefore, the timedelta between the last two time values might differ from the desired timedelta.


Resampled time object

Return type:


  • RuntimeError – When the time data consists only of a single value and has no duration.

  • TypeError – When the passed value is neither an integer or a supported time delta value

  • ValueError – When the passed time delta is equal or lower than 0


>>> from weldx import Time
>>> t = Time(["3s","6s","7s", "9s"])

Resample using an integer:

>>> t.resample(4)
TimedeltaIndex(['0 days 00:00:03', '0 days 00:00:05', '0 days 00:00:07',
                '0 days 00:00:09'],
               dtype='timedelta64[ns]', freq=None)

Resample with a time delta:

>>> t.resample("1.5s")
TimedeltaIndex([       '0 days 00:00:03', '0 days 00:00:04.500000',
                       '0 days 00:00:06', '0 days 00:00:07.500000',
                       '0 days 00:00:09'],
               dtype='timedelta64[ns]', freq='1500ms')