solarpy.processing.resample_to_freq

solarpy.processing.resample_to_freq#

solarpy.processing.resample_to_freq(data, freq, full_days=True, verbose=True)#

Resample a time series to a regular frequency by reindexing.

Creates a complete, evenly spaced DatetimeIndex at the given frequency and reindexes the input data to it. Timesteps not present in the original data are filled with NaN; original timesteps that do not align with the new index are discarded.

Parameters:
  • data (pandas.DataFrame or pandas.Series) – Time series with a DatetimeIndex.

  • freq (str or pandas offset alias) – Target frequency (e.g. "1min", "10min", "1h").

  • full_days (bool, default True) – If True, extend the resampled index to cover the full first and last calendar days (00:00:00 to 23:59:59) rather than stopping at the first and last timestamps in data.

  • verbose (bool, default True) – If True, print the number and percentage of timesteps added and discarded during resampling.

Returns:

Data reindexed to the new regular DatetimeIndex. Missing values are NaN.

Return type:

pandas.DataFrame or pandas.Series