@@ -7375,39 +7375,40 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7375
7375
7376
7376
Parameters
7377
7377
----------
7378
- rule : string
7378
+ rule : str
7379
7379
The offset string or object representing target conversion.
7380
- how : string
7380
+ how : str
7381
7381
Method for down-/re-sampling, default to ‘mean’ for downsampling.
7382
7382
7383
7383
.. deprecated:: 0.18.0
7384
7384
The new syntax is ``.resample(...).mean()``, or
7385
7385
``.resample(...).apply(<func>)``
7386
7386
axis : int, optional, default 0
7387
- Which index to use for up- or down-sampling. Must be
7387
+ Which axis to use for up- or down-sampling. For ``Series`` this
7388
+ will default to 0, i.e. `along the rows`. Must be
7388
7389
``DatetimeIndex``, ``TimedeltaIndex`` or ``PeriodIndex``.
7389
- fill_method : string , default None
7390
+ fill_method : str , default None
7390
7391
Filling method for upsampling.
7391
7392
7392
7393
.. deprecated:: 0.18.0
7393
7394
The new syntax is ``.resample(...).<func>()``,
7394
7395
e.g. ``.resample(...).pad()``
7395
- closed : {'right', 'left'}
7396
+ closed : {'right', 'left'}, default None
7396
7397
Which side of bin interval is closed. The default is 'left'
7397
7398
for all frequency offsets except for 'M', 'A', 'Q', 'BM',
7398
7399
'BA', 'BQ', and 'W' which all have a default of 'right'.
7399
- label : {'right', 'left'}
7400
+ label : {'right', 'left'}, default None
7400
7401
Which bin edge label to label bucket with. The default is 'left'
7401
7402
for all frequency offsets except for 'M', 'A', 'Q', 'BM',
7402
7403
'BA', 'BQ', and 'W' which all have a default of 'right'.
7403
- convention : {'start', 'end', 's', 'e'}
7404
+ convention : {'start', 'end', 's', 'e'}, default 'start'
7404
7405
For ``PeriodIndex`` only, controls whether to use the start or
7405
7406
end of ``rule``.
7406
- kind : {'timestamp', 'period'} optional
7407
+ kind : {'timestamp', 'period'}, optional, default None
7407
7408
Pass 'timestamp' to convert the resulting index to a
7408
7409
``DateTimeIndex`` or 'period' to convert it to a ``PeriodIndex``.
7409
7410
By default the input representation is retained.
7410
- loffset : timedelta
7411
+ loffset : timedelta, default None
7411
7412
Adjust the resampled time labels.
7412
7413
limit : int, default None
7413
7414
Maximum size gap when reindexing with ``fill_method``.
@@ -7417,13 +7418,13 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7417
7418
For frequencies that evenly subdivide 1 day, the "origin" of the
7418
7419
aggregated intervals. For example, for '5min' frequency, base could
7419
7420
range from 0 through 4. Defaults to 0.
7420
- on : string , optional
7421
+ on : str , optional
7421
7422
For a DataFrame, column to use instead of index for resampling.
7422
7423
Column must be datetime-like.
7423
7424
7424
7425
.. versionadded:: 0.19.0
7425
7426
7426
- level : string or int, optional
7427
+ level : str or int, optional
7427
7428
For a MultiIndex, level (name or number) to use for
7428
7429
resampling. ``level`` must be datetime-like.
7429
7430
@@ -7531,7 +7532,7 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7531
7532
Pass a custom function via ``apply``
7532
7533
7533
7534
>>> def custom_resampler(array_like):
7534
- ... return np.sum(array_like)+ 5
7535
+ ... return np.sum(array_like) + 5
7535
7536
7536
7537
>>> series.resample('3T').apply(custom_resampler)
7537
7538
2000-01-01 00:00:00 8
@@ -7542,8 +7543,7 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7542
7543
For a Series with a PeriodIndex, the keyword `convention` can be
7543
7544
used to control whether to use the start or end of `rule`.
7544
7545
7545
- >>> s = pd.Series([1, 2], index=pd.period_range(
7546
- ... '2012-01-01',
7546
+ >>> s = pd.Series([1, 2], index=pd.period_range('2012-01-01',
7547
7547
... freq='A',
7548
7548
... periods=2))
7549
7549
>>> s
@@ -7584,7 +7584,8 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7584
7584
For DataFrame objects, the keyword ``on`` can be used to specify the
7585
7585
column instead of the index for resampling.
7586
7586
7587
- >>> df = pd.DataFrame(data=9*[range(4)], columns=['a', 'b', 'c', 'd'])
7587
+ >>> df = pd.DataFrame(data=9 * [range(4)],
7588
+ ... columns=['a', 'b', 'c', 'd'])
7588
7589
>>> df['time'] = pd.date_range('1/1/2000', periods=9, freq='T')
7589
7590
>>> df.resample('3T', on='time').sum()
7590
7591
a b c d
@@ -7597,7 +7598,7 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
7597
7598
specify on level the resampling needs to take place.
7598
7599
7599
7600
>>> time = pd.date_range('1/1/2000', periods=5, freq='T')
7600
- >>> df2 = pd.DataFrame(data=10* [range(4)],
7601
+ >>> df2 = pd.DataFrame(data=10 * [range(4)],
7601
7602
... columns=['a', 'b', 'c', 'd'],
7602
7603
... index=pd.MultiIndex.from_product([time, [1, 2]])
7603
7604
... )
0 commit comments