pastas.timeseries_utils.get_sample_for_freq#

pastas.timeseries_utils.get_sample_for_freq(s: pandas.Series | pandas.DataFrame, freq: str, tmin: pandas.Timestamp | str | None = None, tmax: pandas.Timestamp | str | None = None)#

Sample a pandas Series or DataFrame so that the frequency is not higher than a supplied frequency.

Parameters:
  • s (pandas.Series or pandas.DataFrame) – The original Series or DataFrame to be sampled.

  • freq (str) – A frequency string accepted by pandas.date_range().

  • tmin (pandas.Timestamp or str, optional) – The start date of the sampled series. If None, the tmin is set to the first index of s. The default is None.

  • tmax (pandas.Timestamp or str, optional) – The end date of the sampled series. If None, the tmax is set to the last index of s. The default is None.

Returns:

The sampled series, consisting of a subset of the original series.

Return type:

pandas.Series