Skip to content

Commit eae898c

Browse files
committed
fix format
1 parent 90c9c5f commit eae898c

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

pandas/core/generic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8008,7 +8008,8 @@ def resample(
80088008
level : str or int, optional
80098009
For a MultiIndex, level (name or number) to use for
80108010
resampling. `level` must be datetime-like.
8011-
origin : {'epoch', 'start', 'start_day', 'end', 'end_day'}, Timestamp or str, default 'start_day'
8011+
origin : {'epoch', 'start', 'start_day', 'end', 'end_day'}, Timestamp
8012+
or str, default 'start_day'
80128013
The timestamp on which to adjust the grouping. The timezone of origin
80138014
must match the timezone of the index.
80148015
If a timestamp is not used, these values are also supported:

pandas/core/groupby/grouper.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ class Grouper:
8383
However, loffset is also deprecated for ``.resample(...)``
8484
See: :class:`DataFrame.resample`
8585
86-
origin : {'epoch', 'start', 'start_day', 'end', 'end_day'}, Timestamp or str, default 'start_day'
86+
origin : {'epoch', 'start', 'start_day', 'end', 'end_day'}, Timestamp
87+
or str, default 'start_day'
8788
The timestamp on which to adjust the grouping. The timezone of origin
8889
must match the timezone of the index.
8990
If a timestamp is not used, these values are also supported:

pandas/core/resample.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1418,8 +1418,9 @@ def __init__(
14181418
self.origin = Timestamp(origin)
14191419
except Exception as e:
14201420
raise ValueError(
1421-
"'origin' should be equal to 'epoch', 'start', 'start_day', 'end', 'end_day' "
1422-
f"or should be a Timestamp convertible type. Got '{origin}' "
1421+
"'origin' should be equal to 'epoch', 'start', 'start_day',"
1422+
" 'end', 'end_day' or should be a Timestamp convertible"
1423+
f" type. Got '{origin}' "
14231424
"instead."
14241425
) from e
14251426

@@ -1431,7 +1432,8 @@ def __init__(
14311432
elif backward:
14321433
if origin in ("start", "start_day"):
14331434
raise ValueError(
1434-
f"`start` or `start_day` origin isn't allowed when `backward` is True"
1435+
f"`start` or `start_day` origin isn't allowed when "
1436+
"`backward` is True"
14351437
)
14361438
self.backward = backward
14371439
else:

pandas/tests/resample/test_resample_api.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,10 @@ def test_backward_resample():
659659

660660
# test datetime origin with backward resample
661661
res = ts.resample(
662-
"17min",
663-
origin="2000-10-02 00:40:00",
664-
backward=True,
665-
).sum().astype("int64")
662+
"17min",
663+
origin="2000-10-02 00:40:00",
664+
backward=True,
665+
).sum().astype("int64")
666666
data = [0, 9, 36, 39, 24]
667667
expected = Series(
668668
data,
@@ -676,10 +676,10 @@ def test_backward_resample():
676676
tm.assert_series_equal(res, expected)
677677

678678
res = ts.resample(
679-
"17min",
680-
origin="2000-10-02 01:05:00",
681-
backward=True,
682-
).sum().astype("int64")
679+
"17min",
680+
origin="2000-10-02 01:05:00",
681+
backward=True,
682+
).sum().astype("int64")
683683
data = [3, 15, 45, 45]
684684
expected = Series(
685685
data,
@@ -694,10 +694,10 @@ def test_backward_resample():
694694

695695
# test right and left close
696696
res = ts.resample(
697-
"17min",
698-
origin="end",
699-
closed="right",
700-
).sum().astype("int64")
697+
"17min",
698+
origin="end",
699+
closed="right",
700+
).sum().astype("int64")
701701
data = [0, 18, 27, 63]
702702
expected = Series(
703703
data,
@@ -711,10 +711,10 @@ def test_backward_resample():
711711
tm.assert_series_equal(res, expected)
712712

713713
res = ts.resample(
714-
"17min",
715-
origin="end",
716-
closed="left",
717-
).sum().astype("int64")
714+
"17min",
715+
origin="end",
716+
closed="left",
717+
).sum().astype("int64")
718718
data = [0, 18, 27, 39, 24]
719719
expected = Series(
720720
data,

0 commit comments

Comments
 (0)