You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here we can see that, when setting ``origin`` to ``'epoch'``, the result after ``'2000-10-02 00:00:00'`` are identical depending on the start of time series:
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v1.1.0.rst
+8-31Lines changed: 8 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -161,7 +161,12 @@ Grouper and resample now supports the arguments origin and offset
161
161
162
162
The bins of the grouping are adjusted based on the beginning of the day of the time series starting point. This works well with frequencies that are multiples of a day (like `30D`) or that divides a day (like `90s` or `1min`). But it can create inconsistencies with some frequencies that do not meet this criteria. To change this behavior you can now specify a fixed timestamp with the argument ``origin``.
163
163
164
-
For example:
164
+
Two arguments are now deprecated (more information in the documentation of :class:`DataFrame.resample`):
165
+
166
+
- ``base`` should be replaced by ``offset``.
167
+
- ``loffset`` should be replaced by directly adding an offset to the index DataFrame after being resampled.
168
+
169
+
Small example of the use of ``origin``:
165
170
166
171
.. ipython:: python
167
172
@@ -185,38 +190,10 @@ Resample using a fixed origin:
185
190
ts.resample('17min', origin='epoch').sum()
186
191
ts.resample('17min', origin='2000-01-01').sum()
187
192
188
-
For a full example, see: :ref:`timeseries.adjust-the-start-of-the-bins`.
189
-
190
-
If needed you can just adjust the bins with an offset that would be added to the default ``origin``.
191
-
Those two examples are equivalent for this time series:
193
+
If needed you can adjust the bins with the argument ``offset`` (a Timedelta) that would be added to the default ``origin``.
192
194
193
-
.. ipython:: python
194
-
195
-
ts.resample('17min', origin='start').sum()
196
-
ts.resample('17min', offset='23h30min').sum()
197
-
198
-
The argument ``base`` is now deprecated in favor of ``offset``. (:issue:`31809`)
199
-
200
-
.. ipython:: python
201
-
:okwarning:
202
-
203
-
ts.resample('17min', base=2).sum()
204
-
205
-
becomes:
206
-
207
-
.. ipython:: python
208
-
209
-
ts.resample('17min', offset='2min').sum()
210
-
211
-
The argument ``loffset`` is now deprecated. You should now add an offset to the index DataFrame after being resampled. (:issue:`31809`)
212
-
213
-
.. ipython:: python
195
+
For a full example, see: :ref:`timeseries.adjust-the-start-of-the-bins`.
0 commit comments