diff --git a/doc/source/whatsnew/v1.2.0.rst b/doc/source/whatsnew/v1.2.0.rst index 016e8d90e7d21..a3353e3df8dae 100644 --- a/doc/source/whatsnew/v1.2.0.rst +++ b/doc/source/whatsnew/v1.2.0.rst @@ -265,6 +265,7 @@ Deprecations - Deprecated indexing :class:`DataFrame` rows with datetime-like strings ``df[string]``, use ``df.loc[string]`` instead (:issue:`36179`) - Deprecated casting an object-dtype index of ``datetime`` objects to :class:`DatetimeIndex` in the :class:`Series` constructor (:issue:`23598`) - Deprecated :meth:`Index.is_all_dates` (:issue:`27744`) +- Use of Date Offset arguments that do not end with 's' overwrites the offset instead of incrementing it. These arguments are deprecated now and slated for removal in a future version (:issue:`36660`) .. --------------------------------------------------------------------------- diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index a78de3eace98c..2277e3da3a612 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -312,6 +312,17 @@ cdef _determine_offset(kwds): 'year', 'month', 'week', 'day', 'weekday', 'hour', 'minute', 'second', 'microsecond') + if any(not k.endswith('s') for k in kwds_no_nanos): + if 'weekday' not in kwds_no_nanos: + warnings.warn( + "Date Offset arguments that do not end with 's' overwrites " + "the offset instead of incrementing it. These arguments " + "are deprecated now and slated for removal in a future " + "version.", + FutureWarning, + stacklevel=1, + ) + use_relativedelta = False if len(kwds_no_nanos) > 0: if any(k in _kwds_use_relativedelta for k in kwds_no_nanos):