Skip to content

DOC: Correct inconsistent description on default DateOffset setting #36516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 31, 2020
2 changes: 1 addition & 1 deletion doc/source/user_guide/timeseries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ into ``freq`` keyword arguments. The available date offsets and associated frequ
:header: "Date Offset", "Frequency String", "Description"
:widths: 15, 15, 65

:class:`~pandas.tseries.offsets.DateOffset`, None, "Generic offset class, defaults to 1 calendar day"
:class:`~pandas.tseries.offsets.DateOffset`, None, "Generic offset class, defaults to a calendar day"
:class:`~pandas.tseries.offsets.BDay` or :class:`~pandas.tseries.offsets.BusinessDay`, ``'B'``,"business day (weekday)"
:class:`~pandas.tseries.offsets.CDay` or :class:`~pandas.tseries.offsets.CustomBusinessDay`, ``'C'``, "custom business day"
:class:`~pandas.tseries.offsets.Week`, ``'W'``, "one week, optionally anchored on a day of the week"
Expand Down
3 changes: 2 additions & 1 deletion pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ cdef _determine_offset(kwds):
# sub-daily offset - use timedelta (tz-aware)
offset = timedelta(**kwds_no_nanos)
else:
offset = timedelta(1)
offset = relativedelta(**{'days':1})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mroeschke I don't know how we can easily deprecate this, nor can we simply change this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't simply change this in the next release, but I think we could deprecate the keyword arguments and slate for removal in 2.0.

use_relativedelta = True
return offset, use_relativedelta


Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/tslibs/test_liboffsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,10 @@ def test_roll_qtr_day_mod_equal(other, month, exp_dict, n, day_opt):
@pytest.mark.parametrize("compare", [29, 1, 31])
def test_roll_convention(n, expected, compare):
assert liboffsets.roll_convention(29, n, compare) == expected[compare]


def test_default_value_for_dateoffset_is_a_calender_day():
# 36516
ts = Timestamp('2011-3-27 00:00:00', tz='Europe/Helsinki')
expected = ts + liboffsets.DateOffset(days=1)
assert ts + liboffsets.DateOffset() == expected