pastas.timeseries_utils.time_weighted_resample ============================================== .. py:function:: pastas.timeseries_utils.time_weighted_resample(s: pandas.Series, index: pandas.Index, method: str = 'stepwise', add_first_index: bool = True, require_full_coverage: bool = False) Time-weighted resampling of a time series to arbitrary periods. :param s: Original time series with a datetime-like index. :type s: pandas.Series :param index: Target time index defining the boundaries of the new periods. :type index: pandas.Index :param method: Interpretation of the original series: - "stepwise" or "flux": treat values as fluxes, piecewise-constant backfilled. - "linear", "state" or "stage": treat values as state variables (stage), interpolate linearly. Default is "stepwise". :type method: {"linear", "stepwise", "state", "flux"}, optional :param add_first_index: If True, the first index value is added to the resulting series, with a NaN value. This is useful when the resulting series needs to have the same index as the target index. If False, the output series has length len(index)-1 and uses index[1:] as its index. Default is True. :type add_first_index: bool, optional :param require_full_coverage: If True, periods that are not fully covered by the original data are masked with NaN. If False, only periods completely outside the range of the original data are masked. Default is False. :type require_full_coverage: bool, optional :raises ValueError: If `method` is not supported or input is not strictly increasing. :returns: **s_new** -- Resampled time series. Each value represents the time-weighted mean over the corresponding period. Periods not covered by the original data are NaN. :rtype: pandas.Series .. !! processed by numpydoc !!