-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
correct inconsistent doc description on default DateOffset setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @GYHHAHA
Also heads up there are linting issues
to be resolved before merge |
remove the example for DateOffset default setting
why fail and how can I fix? |
What's wrong with "one calendar day"? |
One calendar day will get the result below.
But now the default action is add absolute 24 hours.
|
Ah, thanks! |
So how can I fix these failings? Seems that I only change one line. |
They're unrelated, you'll probably need to merge upstream/master later |
doc/source/user_guide/timeseries.rst
Outdated
@@ -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 24 hours" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @mroeschke
But still a little strange about the default value, why not just set it a calendar day since the offset objects are specially designed for calendar duration rules? |
I will take a try. |
Change the default setting for DateOffset to a calendar day.
add a test for dateoffset default value
Hello @GYHHAHA! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-09-22 06:42:18 UTC |
change doc to original description
resolve PEP 8 issues
pandas/_libs/tslibs/offsets.pyx
Outdated
@@ -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}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Also since the
Caused by the default |
Ok, I will keep this in original form, and should I continue to change the "1 calendar day" to "24 hours" in the DOC?
Thanks. @jreback @mroeschke |
Yes I think for this PR, you can just make the documentation change. You can follow up with another PR to deprecate the DateOffset arguments that do not end in Also if you could submit a bug report with the nanosecond example, that'd be great. |
Here are also some problems. DOC says "However, all DateOffset subclasses that are an hour or smaller (Hour, Minute, Second, Milli, Micro, Nano) behave like Timedelta and respect absolute time.". But though Is it necessary to keep this consistency? Besides, in #36592 I suggest to add However, we can only use Thanks! @mroeschke |
See #22864 about the For absolute time changes, I think users should just stick to using |
agree with jbrockmendel
It will be much more clear to only consider the relative time (day, week, month ,year, ...) for offsets and tick time (nano, ..., minute, hour, absolute day) for timedelta. |
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
@mroeschke this lgtu? |
Thanks @GYHHAHA |
…andas-dev#36516) * Update timeseries.rst correct inconsistent doc description on default DateOffset setting * Update timeseries.rst remove the example for DateOffset default setting * Update offsets.pyx Change the default setting for DateOffset to a calendar day. * Update test_liboffsets.py add a test for dateoffset default value * Update timeseries.rst change doc to original description * Update test_liboffsets.py resolve PEP 8 issues * Update timeseries.rst * Update test_liboffsets.py * Update offsets.pyx * Change default Offset setting description in DOC * Update timeseries.rst * Update timeseries.rst
…andas-dev#36516) * Update timeseries.rst correct inconsistent doc description on default DateOffset setting * Update timeseries.rst remove the example for DateOffset default setting * Update offsets.pyx Change the default setting for DateOffset to a calendar day. * Update test_liboffsets.py add a test for dateoffset default value * Update timeseries.rst change doc to original description * Update test_liboffsets.py resolve PEP 8 issues * Update timeseries.rst * Update test_liboffsets.py * Update offsets.pyx * Change default Offset setting description in DOC * Update timeseries.rst * Update timeseries.rst
correct inconsistent doc description on default DateOffset setting