-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: add examples to offsets CustomBusinessDay, Business/MonthBegin #51932
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
DOC: add examples to offsets CustomBusinessDay, Business/MonthBegin #51932
Conversation
Hi @MarcoGorelli. I updated documentation for |
/preview |
Website preview of this PR available at: https://pandas.pydata.org/preview/51932/ |
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.
Nice, thanks for working on this!
Just got a comment on offset
Website preview of this PR available at: https://pandas.pydata.org/preview/51932/
😱 wow, nice!
@@ -3688,13 +3717,38 @@ cdef class CustomBusinessDay(BusinessDay): | |||
List/array of dates to exclude from the set of valid business days, | |||
passed to ``numpy.busdaycalendar``. | |||
calendar : np.busdaycalendar | |||
offset : timedelta, default timedelta(0) |
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.
why remove offset
? I think it works, e.g.
In [18]: pd.Timestamp(2022, 8, 5, 16) + pd.offsets.CustomBusinessDay(1)
Out[18]: Timestamp('2022-08-08 16:00:00')
In [19]: pd.Timestamp(2022, 8, 5, 16) + pd.offsets.CustomBusinessDay(1, offset=timedelta(days=1))
Out[19]: Timestamp('2022-08-09 16:00:00')
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.
Thank you for the comment. It was my mistake, I thought offset doesn’t have an effect on CustomBusinessDay
. I corrected the list of parameters and add an example for offset.
I noticed, that we don't have offset in the list of parameters in BusinessDay
. Maybe it would be good to add it?
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.
yup, sounds good, thanks for checking!
Looks like ci failures are related to my new example for offset.
I use Linux and can’t catch errors raised for windows platform. There is a Timedelta function in pandas, which shifts days as well and I can use this one. |
Nice, thank you! |
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.
Really nice, this makes it so much easier to use, thanks @natmokval !
it's unrelated, it happens before even having finished compiling pandas (which isn't affected by docstrings) |
This pr is related to pr #50182, #49958 and #50027.
Updated docs for
BusinessMonthBegin
,CustomBusinessDay
andMonthBegin
. Added more examples to highlight “the first day of the month” behavior. Gave examples that use the parameter n equals 0. Provided more examples for CustomBusinessDay parameters weekmask and calendar.