From 7f47208f489d03bb79d21134cff7900604a8bb11 Mon Sep 17 00:00:00 2001 From: Adetoro Akinola Date: Tue, 1 Aug 2023 08:29:06 -0500 Subject: [PATCH 1/6] details on weekday argument for DateOffset docs --- pandas/_libs/tslibs/offsets.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 84b102bd4a262..9d3d637efd097 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1373,7 +1373,25 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): previous midnight. **kwds Temporal parameter that add to or replace the offset value. + weekday : int {0, 1, ..., 6}, default 0 + A specific integer for the day of the week. + - 0 is Monday + - 1 is Tuesday + - 2 is Wednesday + - 3 is Thursday + - 4 is Friday + - 5 is Saturday + - 6 is Sunday. + Instead Weekday type from dateutil.relativedelta can be used. + - MO is Monday + - TU is Tuesday + - WE is Wednesday + - TH is Thursday + - FR is Friday + - SA is Saturday + - SU is Sunday. + Parameters that **add** to the offset (like Timedelta): - years From 5e6cbf288f9b722e3cf010a217d8177c1ef352c3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 15:20:38 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pandas/_libs/tslibs/offsets.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 9d3d637efd097..117433eaf2cac 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1391,7 +1391,7 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): - FR is Friday - SA is Saturday - SU is Sunday. - + Parameters that **add** to the offset (like Timedelta): - years From 3e4dbd718fe4d86a42314845c0ff64ad2b1601c8 Mon Sep 17 00:00:00 2001 From: Adetoro Akinola Date: Thu, 3 Aug 2023 10:39:22 -0500 Subject: [PATCH 3/6] details on weekday argument for DateOffset docs --- pandas/_libs/tslibs/offsets.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 84b102bd4a262..466e069524a5d 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1373,6 +1373,24 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): previous midnight. **kwds Temporal parameter that add to or replace the offset value. + weekday : int {0, 1, ..., 6}, default 0 + A specific integer for the day of the week. + - 0 is Monday + - 1 is Tuesday + - 2 is Wednesday + - 3 is Thursday + - 4 is Friday + - 5 is Saturday + - 6 is Sunday + + Instead Weekday type from dateutil.relativedelta can be used. + - MO is Monday + - TU is Tuesday + - WE is Wednesday + - TH is Thursday + - FR is Friday + - SA is Saturday + - SU is Sunday. Parameters that **add** to the offset (like Timedelta): From 8bc4ee3c24edca84cff08d17fe00355696cb996b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 13:21:55 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pandas/_libs/tslibs/offsets.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index c41e3e535699f..d67ef2d8a195a 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1468,7 +1468,7 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): **kwds Temporal parameter that add to or replace the offset value. weekday : int {0, 1, ..., 6}, default 0 - + A specific integer for the day of the week. - 0 is Monday - 1 is Tuesday From b27a66fec623e0cee12652c2d914ed7395342ba6 Mon Sep 17 00:00:00 2001 From: Adetoro Akinola Date: Thu, 17 Aug 2023 10:23:43 -0500 Subject: [PATCH 5/6] details on weekday argument for DateOffset docs --- pandas/_libs/tslibs/offsets.pyx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 7c0f443f71b39..2dcd8eb4b7b02 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -498,7 +498,7 @@ cdef class BaseOffset: def __sub__(self, other): if PyDateTime_Check(other): raise TypeError("Cannot subtract datetime from offset.") - elif type(other) == type(self): + elif type(other) is type(self): return type(self)(self.n - other.n, normalize=self.normalize, **self.kwds) elif not isinstance(self, BaseOffset): @@ -1047,7 +1047,7 @@ cdef class Tick(SingleConstructorOffset): return other.__add__(self) if isinstance(other, Tick): - if type(self) == type(other): + if type(self) is type(other): return type(self)(self.n + other.n) else: return delta_to_tick(self.delta + other.delta) @@ -1374,17 +1374,19 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): **kwds Temporal parameter that add to or replace the offset value. weekday : int {0, 1, ..., 6}, default 0 - + A specific integer for the day of the week. + - 0 is Monday - 1 is Tuesday - 2 is Wednesday - 3 is Thursday - 4 is Friday - 5 is Saturday - - 6 is Sunday. + - 6 is Sunday Instead Weekday type from dateutil.relativedelta can be used. + - MO is Monday - TU is Tuesday - WE is Wednesday From d6990851b8448dc0ba0ba724d9f8c0de87b7604d Mon Sep 17 00:00:00 2001 From: Adetoro Akinola Date: Thu, 24 Aug 2023 10:51:52 -0500 Subject: [PATCH 6/6] details on weekday argument for DateOffset docs --- pandas/_libs/tslibs/offsets.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index c03fd88ae1bfe..a013fb5c6c1c0 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1465,8 +1465,6 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): normalize : bool, default False Whether to round the result of a DateOffset addition down to the previous midnight. - **kwds - Temporal parameter that add to or replace the offset value. weekday : int {0, 1, ..., 6}, default 0 A specific integer for the day of the week. @@ -1489,6 +1487,9 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): - SA is Saturday - SU is Sunday. + **kwds + Temporal parameter that add to or replace the offset value. + Parameters that **add** to the offset (like Timedelta): - years