Skip to content

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

Merged
merged 7 commits into from
Jan 4, 2018

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Jan 2, 2018

Similar to [need to lookup reference], this fixes bugs in LastWeekOfMonth and FY5253Quarter to ensure that the fast implementation offset.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.

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@codecov
Copy link

codecov bot commented Jan 2, 2018

Codecov Report

Merging #19036 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 89.91% <100%> (+0.02%) ⬆️
#single 41.63% <5.12%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/tseries/offsets.py 96.97% <100%> (ø) ⬆️
pandas/plotting/_converter.py 66.95% <0%> (+1.73%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3198b9d...8b0c604. Read the comment docs.

@gfyoung gfyoung added Bug Datetime Datetime data dtype Timedelta Timedelta data type and removed Datetime Datetime data dtype labels Jan 2, 2018


def test_fy5253qtr_onoffset_nearest():
ts = Timestamp('1985-09-02 23:57:46.232550356-0300',
Copy link
Member

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.

@gfyoung
Copy link
Member

gfyoung commented Jan 3, 2018

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

you allow this below

Copy link
Member Author

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.

Copy link
Contributor

@jreback jreback left a 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.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use .format()

Copy link
Contributor

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())

Copy link
Member Author

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.


Returns
-------
prev_year_end : Timestamp giving most recent fiscal year end
Copy link
Contributor

Choose a reason for hiding this comment

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

tuple of

@jreback jreback added this to the 0.23.0 milestone Jan 4, 2018
@jbrockmendel
Copy link
Member Author

Ping

@jreback jreback merged commit f911765 into pandas-dev:master Jan 4, 2018
@jreback
Copy link
Contributor

jreback commented Jan 4, 2018

thanks!

@jbrockmendel jbrockmendel deleted the offsets-fyquarters branch January 23, 2018 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants