Skip to content

simplify CBMonth.apply to remove roll_monthday #19146

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 5 commits into from
Jan 10, 2018

Conversation

jbrockmendel
Copy link
Member

The implementations of CustomBusinessMonthBegin.apply and CustomBusinessMonthEnd.apply are merged.

Simplify CustomBusinessMonth.apply so that it uses liboffsets.roll_convention instead of liboffsets.roll_monthday (the latter being much more of a footgun). This is the last place where roll_monthday was used, so this removes it.

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

return CustomBusinessDay(n=self.n, normalize=self.normalize, **kwds)
cbday = CustomBusinessDay(n=self.n, normalize=False, **self.kwds)

# Define default roll function to be called in apply method
Copy link
Contributor

Choose a reason for hiding this comment

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

why not simply define roll_func (better name?) as a property (or function) or CBD?

__doc__ = _CustomBusinessMonth.__doc__.replace('[BEGIN/END]', 'end')
_prefix = 'CBM'
moff = MonthEnd(n=1, normalize=False)
moff.roll_func = moff.rollforward
Copy link
Contributor

Choose a reason for hiding this comment

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

same, this is very odd to do, just make this a property

@jreback jreback added Frequency DateOffsets Clean labels Jan 9, 2018
@codecov
Copy link

codecov bot commented Jan 9, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@9d8dbef). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #19146   +/-   ##
=========================================
  Coverage          ?   91.51%           
=========================================
  Files             ?      148           
  Lines             ?    48782           
  Branches          ?        0           
=========================================
  Hits              ?    44641           
  Misses            ?     4141           
  Partials          ?        0
Flag Coverage Δ
#multiple 89.88% <100%> (?)
#single 41.61% <19.04%> (?)
Impacted Files Coverage Δ
pandas/tseries/offsets.py 96.98% <100%> (ø)

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 9d8dbef...4ee7c82. Read the comment docs.

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.

some more doc-strings, otherwise lgtm.

_prefix = 'CBM'
@cache_readonly
def month_roll(self):
if self._prefix.endswith('S'):
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 add a comment to this and cbday_roll. I like the syntax, but a future reader won't get this immediately.

def cbday_roll(self):
cbday = CustomBusinessDay(n=self.n, normalize=False, **self.kwds)

# Define default roll function to be called in apply method
Copy link
Contributor

Choose a reason for hiding this comment

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

move the comment to a doc-string

@jreback jreback added this to the 0.23.0 milestone Jan 10, 2018
@jreback jreback merged commit 7351b43 into pandas-dev:master Jan 10, 2018
@jreback
Copy link
Contributor

jreback commented Jan 10, 2018

thanks!

maximveksler pushed a commit to maximveksler/pandas that referenced this pull request Jan 11, 2018
@jbrockmendel jbrockmendel deleted the offsets-cbmonths 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants