Skip to content

CLN: day->day_opt, remove unused case in liboffsets.get_day_of_month #34762

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 1 commit into from
Jun 14, 2020

Conversation

jbrockmendel
Copy link
Member

Removing this unused case turns out to be a blocker to making get_day_of_month nogil, which in turn will allow a bunch of de-duplication in this file.

@jreback jreback added this to the 1.1 milestone Jun 14, 2020
@jreback jreback added the Frequency DateOffsets label Jun 14, 2020
@@ -4095,9 +4093,6 @@ cdef int get_day_of_month(datetime other, day_opt) except? -1:
elif day_opt == 'business_end':
# last business day of month
return get_lastbday(other.year, other.month)
elif is_integer_object(day_opt):
days_in_month = get_days_in_month(other.year, other.month)
return min(day_opt, days_in_month)
elif day_opt is None:
# Note: unlike `shift_month`, get_day_of_month does not
# allow day_opt = None
Copy link
Contributor

Choose a reason for hiding this comment

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

I would check if we have tests for this raise case (also doesn't need to be an else anymore as everything returns. followon on).

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, we have tests for both the ValueError and NotImplementedError cases here

Copy link
Member Author

Choose a reason for hiding this comment

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

as for "else", I get compile-time failures about unreached code

@jreback jreback merged commit 04d4075 into pandas-dev:master Jun 14, 2020
@jreback
Copy link
Contributor

jreback commented Jun 14, 2020

thanka followo suggestion

@jbrockmendel jbrockmendel deleted the ref-liboffsets-day_opt branch June 14, 2020 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frequency DateOffsets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants