-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fix bugs in FY5253Quarter and LastWeekOfMonth #19036
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
Codecov Report
@@ Coverage Diff @@
## master #19036 +/- ##
==========================================
+ Coverage 91.51% 91.54% +0.02%
==========================================
Files 148 148
Lines 48807 48808 +1
==========================================
+ Hits 44667 44680 +13
+ Misses 4140 4128 -12
Continue to review full report at Codecov.
|
|
||
|
||
def test_fy5253qtr_onoffset_nearest(): | ||
ts = Timestamp('1985-09-02 23:57:46.232550356-0300', |
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.
Reference your PR as a comment. Same for all other tests that you added.
https://travis-ci.org/pandas-dev/pandas/jobs/324352177 Not sure why this keeps timing out. |
@apply_wraps | ||
def apply(self, other): | ||
base = other | ||
# Note: self.n == 0 is not allowed. |
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.
you allow this below
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.
This is enforced in init.
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.
small comments, needs a rebase, ping on green.
pandas/tseries/offsets.py
Outdated
@@ -1951,7 +1941,7 @@ class FY5253Quarter(DateOffset): | |||
or 14 week when needed. {1,2,3,4} | |||
variation : str | |||
{"nearest", "last"} for "LastOfMonth" or "NearestEndMonth" | |||
""" | |||
""" % _5253doc |
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 you use .format()
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.
and same on all the templates (generally we want to always use the .format())
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.
That was the first attempt. That syntax doesn't play nicely with the set syntax inside the docstring. The docstring change here is tangential to the PR; I'll just revert it.
pandas/tseries/offsets.py
Outdated
|
||
Returns | ||
------- | ||
prev_year_end : Timestamp giving most recent fiscal year end |
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.
tuple of
Ping |
thanks! |
Similar to [need to lookup reference], this fixes bugs in
LastWeekOfMonth
andFY5253Quarter
to ensure that the fast implementationoffset.onOffset(ts)
matches the slow (base class) implementation(ts + offset) - offset == ts
.I haven't yet looked at BusinessHour and CustomBusinessHour, but other than that I think these are the last classes that have this category of bug.
git diff upstream/master -u -- "*.py" | flake8 --diff