pyspark.pandas.DataFrame.resampleΒΆ

DataFrame.resample(rule: str, closed: Optional[str] = None, label: Optional[str] = None, on: Optional[Series] = None) β†’ DataFrameResampler[source]ΒΆ

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.

New in version 3.4.0.

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.