pyspark.pandas.DataFrame.resample

DataFrame.resample(rule: str, closed: Optional[str] = None, label: Optional[str] = None, on: Optional[Series] = None) → DataFrameResampler

Resample time-series data.

Convenience method for frequency conversion and resampling of time series. The object must have a datetime-like index (only support DatetimeIndex for now), or the caller must pass the label of a datetime-like series/index to the on keyword parameter.

Parameters
rulestr

The offset string or object representing target conversion. Currently, supported units are {‘Y’, ‘A’, ‘M’, ‘D’, ‘H’, ‘T’, ‘MIN’, ‘S’}.

closed{{‘right’, ‘left’}}, default None

Which side of bin interval is closed. The default is ‘left’ for all frequency offsets except for ‘A’, ‘Y’ and ‘M’ which all have a default of ‘right’.

label{{‘right’, ‘left’}}, default None

Which bin edge label to label bucket with. The default is ‘left’ for all frequency offsets except for ‘A’, ‘Y’ and ‘M’ which all have a default of ‘right’.

onSeries, optional

For a DataFrame, column to use instead of index for resampling. Column must be datetime-like.

Returns
DataFrameResampler

See also

Series.resample

Resample a Series.

groupby

Group by mapping, function, label, or list of labels.