From facecf8013d92855dd19dc0869c281d39b293951 Mon Sep 17 00:00:00 2001 From: sainivasrangaraju Date: Sat, 26 Apr 2025 20:57:44 -0500 Subject: [PATCH 1/4] DOC: Added constructor parameters to DateOffset docstring for API consistency --- pandas/_libs/tslibs/offsets.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index a16964435ef50..1f5a08d7cc8f4 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1637,6 +1637,8 @@ class OffsetMeta(type): # TODO: figure out a way to use a metaclass with a cdef class class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): """ + class pandas.tseries.offsets.DateOffset(n = 1, normalize = False, weekday = 0, **kwds) + Standard kind of date increment used for a date range. Works exactly like the keyword argument form of relativedelta. From 90551b5829327d918dafd8e4d969b6b53b0fd83e Mon Sep 17 00:00:00 2001 From: sainivasrangaraju Date: Sat, 26 Apr 2025 22:43:33 -0500 Subject: [PATCH 2/4] Started the doc with the summary line already existing --- pandas/_libs/tslibs/offsets.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 1f5a08d7cc8f4..75468dd6c0a47 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1637,10 +1637,10 @@ class OffsetMeta(type): # TODO: figure out a way to use a metaclass with a cdef class class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): """ - class pandas.tseries.offsets.DateOffset(n = 1, normalize = False, weekday = 0, **kwds) - Standard kind of date increment used for a date range. + class pandas.tseries.offsets.DateOffset(n = 1, normalize = False, weekday = 0, **kwds) + Works exactly like the keyword argument form of relativedelta. Note that the positional argument form of relativedelta is not supported. Use of the keyword n is discouraged-- you would be better From 03290621001c0016e4e23d6f4ea91f2af19ef0a4 Mon Sep 17 00:00:00 2001 From: sainivasrangaraju Date: Sat, 26 Apr 2025 23:46:58 -0500 Subject: [PATCH 3/4] Removed blank spaces and tabs in the documentation --- pandas/_libs/tslibs/offsets.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 75468dd6c0a47..8f1fd6731fde9 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1639,8 +1639,10 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): """ Standard kind of date increment used for a date range. - class pandas.tseries.offsets.DateOffset(n = 1, normalize = False, weekday = 0, **kwds) - + class pandas.tseries.offsets.DateOffset( + n = 1, normalize = False, weekday = 0, **kwds + ) + Works exactly like the keyword argument form of relativedelta. Note that the positional argument form of relativedelta is not supported. Use of the keyword n is discouraged-- you would be better From aa2e35f3518001dc0deac2ed67cf001e3e3588b2 Mon Sep 17 00:00:00 2001 From: sainivasrangaraju Date: Sun, 27 Apr 2025 01:12:05 -0500 Subject: [PATCH 4/4] Used backticks for kwds to remove warning --- 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 8f1fd6731fde9..bfe177095418d 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -1640,7 +1640,7 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): Standard kind of date increment used for a date range. class pandas.tseries.offsets.DateOffset( - n = 1, normalize = False, weekday = 0, **kwds + n = 1, normalize = False, weekday = 0, ``**kwds`` ) Works exactly like the keyword argument form of relativedelta.