Skip to content

Commit 2c23296

Browse files
committed
DOC: Remove some validation errors in resample (pandas-dev#22894)
* First iteration over some validation errors on pandas.Series.resample. * Fix multi-line examples issue.
1 parent 913f71f commit 2c23296

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

pandas/core/generic.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7366,6 +7366,8 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
73667366
label=None, convention='start', kind=None, loffset=None,
73677367
limit=None, base=0, on=None, level=None):
73687368
"""
7369+
Resample a time series by changing the frequency of the index.
7370+
73697371
Convenience method for frequency conversion and resampling of time
73707372
series. Object must have a datetime-like index (DatetimeIndex,
73717373
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,
73747376
Parameters
73757377
----------
73767378
rule : string
7377-
the offset string or object representing target conversion
7379+
The offset string or object representing target conversion.
73787380
axis : int, optional, default 0
7381+
73797382
closed : {'right', 'left'}
73807383
Which side of bin interval is closed. The default is 'left'
73817384
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,
73867389
'BA', 'BQ', and 'W' which all have a default of 'right'.
73877390
convention : {'start', 'end', 's', 'e'}
73887391
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
73917394
Pass 'timestamp' to convert the resulting index to a
73927395
``DateTimeIndex`` or 'period' to convert it to a ``PeriodIndex``.
73937396
By default the input representation is retained.
73947397
loffset : timedelta
7395-
Adjust the resampled time labels
7398+
Adjust the resampled time labels.
73967399
base : int, default 0
73977400
For frequencies that evenly subdivide 1 day, the "origin" of the
73987401
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.
74007403
on : string, optional
74017404
For a DataFrame, column to use instead of index for resampling.
74027405
Column must be datetime-like.
@@ -7522,9 +7525,10 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
75227525
For a Series with a PeriodIndex, the keyword `convention` can be
75237526
used to control whether to use the start or end of `rule`.
75247527
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))
75287532
>>> s
75297533
2012 1
75307534
2013 2
@@ -7577,9 +7581,9 @@ def resample(self, rule, how=None, axis=0, fill_method=None, closed=None,
75777581
75787582
>>> time = pd.date_range('1/1/2000', periods=5, freq='T')
75797583
>>> 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+
... )
75837587
>>> df2.resample('3T', level=0).sum()
75847588
a b c d
75857589
2000-01-01 00:00:00 0 6 12 18

0 commit comments

Comments
 (0)