pastas.utils.timestep_weighted_resample

timestep_weighted_resample(series0, tindex)[source]

Resample a timeseries to a new tindex, using an overlapping period weighted average.

The original series and the new tindex do not have to be equidistant. Also, the timestep-edges of the new tindex do not have to overlap with the original series.

It is assumed the series consists of measurements that describe an intensity at the end of the period for which they apply. Therefore, when upsampling, the values are uniformly spread over the new timestep (like bfill).

Compared to the reample methods in Pandas, this method is more accurate for non-equidistanct series. It is much slower however.

Parameters
  • series0 (pandas.Series) – The original series to be resampled

  • tindex (pandas.index) – The index to which to resample the series

Returns

series – The resampled series

Return type

pandas.Series