Returns a Resample object for performing resampling operations. Handles both downsampling and upsampling. The resampled dimension must be a datetime-like coordinate. If any intervals contain no values from the original object, they will be given the value ``NaN``.
(
self,
resample_cls: type[T_Resample],
indexer: Mapping[Hashable, ResampleCompatible | Resampler] | None,
skipna: bool | None,
closed: SideOptions | None,
label: SideOptions | None,
offset: pd.Timedelta | datetime.timedelta | str | None,
origin: str | DatetimeLike,
restore_coord_dims: bool | None,
**indexer_kwargs: ResampleCompatible | Resampler,
)
| 916 | return RollingExp(self, window, window_type) |
| 917 | |
| 918 | def _resample( |
| 919 | self, |
| 920 | resample_cls: type[T_Resample], |
| 921 | indexer: Mapping[Hashable, ResampleCompatible | Resampler] | None, |
| 922 | skipna: bool | None, |
| 923 | closed: SideOptions | None, |
| 924 | label: SideOptions | None, |
| 925 | offset: pd.Timedelta | datetime.timedelta | str | None, |
| 926 | origin: str | DatetimeLike, |
| 927 | restore_coord_dims: bool | None, |
| 928 | **indexer_kwargs: ResampleCompatible | Resampler, |
| 929 | ) -> T_Resample: |
| 930 | """Returns a Resample object for performing resampling operations. |
| 931 | |
| 932 | Handles both downsampling and upsampling. The resampled |
| 933 | dimension must be a datetime-like coordinate. If any intervals |
| 934 | contain no values from the original object, they will be given |
| 935 | the value ``NaN``. |
| 936 | |
| 937 | Parameters |
| 938 | ---------- |
| 939 | indexer : {dim: freq}, optional |
| 940 | Mapping from the dimension name to resample frequency [1]_. The |
| 941 | dimension must be datetime-like. |
| 942 | skipna : bool, optional |
| 943 | Whether to skip missing values when aggregating in downsampling. |
| 944 | closed : {"left", "right"}, optional |
| 945 | Side of each interval to treat as closed. |
| 946 | label : {"left", "right"}, optional |
| 947 | Side of each interval to use for labeling. |
| 948 | origin : {'epoch', 'start', 'start_day', 'end', 'end_day'}, pd.Timestamp, datetime.datetime, np.datetime64, or cftime.datetime, default 'start_day' |
| 949 | The datetime on which to adjust the grouping. The timezone of origin |
| 950 | must match the timezone of the index. |
| 951 | |
| 952 | If a datetime is not used, these values are also supported: |
| 953 | - 'epoch': `origin` is 1970-01-01 |
| 954 | - 'start': `origin` is the first value of the timeseries |
| 955 | - 'start_day': `origin` is the first day at midnight of the timeseries |
| 956 | - 'end': `origin` is the last value of the timeseries |
| 957 | - 'end_day': `origin` is the ceiling midnight of the last day |
| 958 | offset : pd.Timedelta, datetime.timedelta, or str, default is None |
| 959 | An offset timedelta added to the origin. |
| 960 | restore_coord_dims : bool, optional |
| 961 | If True, also restore the dimension order of multi-dimensional |
| 962 | coordinates. |
| 963 | **indexer_kwargs : {dim: freq} |
| 964 | The keyword arguments form of ``indexer``. |
| 965 | One of indexer or indexer_kwargs must be provided. |
| 966 | |
| 967 | Returns |
| 968 | ------- |
| 969 | resampled : same type as caller |
| 970 | This object resampled. |
| 971 | |
| 972 | Examples |
| 973 | -------- |
| 974 | Downsample monthly time-series data to seasonal data: |
| 975 |
no test coverage detected