@@ -7366,6 +7366,8 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7366
7366
label = None , convention = 'start' , kind = None , loffset = None ,
7367
7367
limit = None , base = 0 , on = None , level = None ):
7368
7368
"""
7369
+ Resample a time series by changing the frequency of the index.
7370
+
7369
7371
Convenience method for frequency conversion and resampling of time
7370
7372
series. Object must have a datetime-like index (DatetimeIndex,
7371
7373
PeriodIndex, or TimedeltaIndex), or pass datetime-like values
@@ -7374,8 +7376,9 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7374
7376
Parameters
7375
7377
----------
7376
7378
rule : string
7377
- the offset string or object representing target conversion
7379
+ The offset string or object representing target conversion.
7378
7380
axis : int, optional, default 0
7381
+
7379
7382
closed : {'right', 'left'}
7380
7383
Which side of bin interval is closed. The default is 'left'
7381
7384
for all frequency offsets except for 'M', 'A', 'Q', 'BM',
@@ -7386,17 +7389,17 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7386
7389
'BA', 'BQ', and 'W' which all have a default of 'right'.
7387
7390
convention : {'start', 'end', 's', 'e'}
7388
7391
For PeriodIndex only, controls whether to use the start or end of
7389
- `rule`
7390
- kind: {'timestamp', 'period'}, optional
7392
+ `rule`.
7393
+ kind : {'timestamp', 'period'} optional
7391
7394
Pass 'timestamp' to convert the resulting index to a
7392
7395
``DateTimeIndex`` or 'period' to convert it to a ``PeriodIndex``.
7393
7396
By default the input representation is retained.
7394
7397
loffset : timedelta
7395
- Adjust the resampled time labels
7398
+ Adjust the resampled time labels.
7396
7399
base : int, default 0
7397
7400
For frequencies that evenly subdivide 1 day, the "origin" of the
7398
7401
aggregated intervals. For example, for '5min' frequency, base could
7399
- range from 0 through 4. Defaults to 0
7402
+ range from 0 through 4. Defaults to 0.
7400
7403
on : string, optional
7401
7404
For a DataFrame, column to use instead of index for resampling.
7402
7405
Column must be datetime-like.
@@ -7522,9 +7525,10 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7522
7525
For a Series with a PeriodIndex, the keyword `convention` can be
7523
7526
used to control whether to use the start or end of `rule`.
7524
7527
7525
- >>> s = pd.Series([1, 2], index=pd.period_range('2012-01-01',
7526
- freq='A',
7527
- periods=2))
7528
+ >>> s = pd.Series([1, 2], index=pd.period_range(
7529
+ ... '2012-01-01',
7530
+ ... freq='A',
7531
+ ... periods=2))
7528
7532
>>> s
7529
7533
2012 1
7530
7534
2013 2
@@ -7577,9 +7581,9 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7577
7581
7578
7582
>>> time = pd.date_range('1/1/2000', periods=5, freq='T')
7579
7583
>>> df2 = pd.DataFrame(data=10*[range(4)],
7580
- columns=['a', 'b', 'c', 'd'],
7581
- index=pd.MultiIndex.from_product([time, [1, 2]])
7582
- )
7584
+ ... columns=['a', 'b', 'c', 'd'],
7585
+ ... index=pd.MultiIndex.from_product([time, [1, 2]])
7586
+ ... )
7583
7587
>>> df2.resample('3T', level=0).sum()
7584
7588
a b c d
7585
7589
2000-01-01 00:00:00 0 6 12 18
0 commit comments