Skip to content

Commit 343a30a

Browse files
committed
DOC: change doc after review
1 parent 4ad979a commit 343a30a

File tree

2 files changed

+10
-33
lines changed

2 files changed

+10
-33
lines changed

doc/source/user_guide/timeseries.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,8 +1809,8 @@ Here we can see that, when using ``origin`` with its default value (``'start_day
18091809

18101810
.. ipython:: python
18111811
1812-
ts.resample('17min').sum()
1813-
ts[middle:end].resample('17min').sum()
1812+
ts.resample('17min', origin='start_day').sum()
1813+
ts[middle:end].resample('17min', origin='start_day').sum()
18141814
18151815
18161816
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:

doc/source/whatsnew/v1.1.0.rst

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ Grouper and resample now supports the arguments origin and offset
161161

162162
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``.
163163

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``:
165170

166171
.. ipython:: python
167172
@@ -185,38 +190,10 @@ Resample using a fixed origin:
185190
ts.resample('17min', origin='epoch').sum()
186191
ts.resample('17min', origin='2000-01-01').sum()
187192
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``.
192194

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`.
214196

215-
from pandas.tseries.frequencies import to_offset
216-
loffset = '19min'
217-
ts_out = ts.resample('17min').sum()
218-
ts_out.index = ts_out.index + to_offset(loffset)
219-
ts_out
220197

221198
.. _whatsnew_110.enhancements.other:
222199

0 commit comments

Comments
 (0)