-
- Notifications
You must be signed in to change notification settings - Fork 19.2k
BUG: #29049 make holiday support offsets of offsets #57938
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
mroeschke merged 18 commits into pandas-dev:main from dontgoto:#29049_make_holiday_support_offsets_of_offsets Mar 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
18 commits Select commit Hold shift + click to select a range
7bee907 support offsets of offsets in holiday creation
dontgoto aaa781f update whatsnew
dontgoto 0cf929e add type annotations
dontgoto 8a9a4b6 update type annotation
dontgoto 8e572bb make types compatible
dontgoto 0548ddf update docstring
dontgoto a3d44e5 Merge branch 'main' into #29049_make_holiday_support_offsets_of_offsets
dontgoto 98f3d96 Merge branch 'main' into #29049_make_holiday_support_offsets_of_offsets
dontgoto d18187c Merge branch 'main' into #29049_make_holiday_support_offsets_of_offsets
dontgoto bb6e2b5 Merge branch 'main' into #29049_make_holiday_support_offsets_of_offsets
dontgoto c24b143 don't accept, only raise with more informative exception
dontgoto 8bc29a3 Merge remote-tracking branch 'origin/#29049_make_holiday_support_offs…
dontgoto af3f19e add attribute type hint
dontgoto a1b9854 change array to list in docstring
dontgoto b80523a broaden if check; specify error message
dontgoto 6a723f3 Merge remote-tracking branch 'origin/#29049_make_holiday_support_offs…
dontgoto 085a740 update test raises message
dontgoto b779c75 Merge branch 'main' into #29049_make_holiday_support_offsets_of_offsets
dontgoto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
don't accept, only raise with more informative exception
- Loading branch information
commit c24b1431fe4ee89cd6cdcd23e291f56c5e4ec2d3
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -166,7 +166,7 @@ def __init__( | |
| year=None, | ||
| month=None, | ||
| day=None, | ||
| offset: BaseOffset | list[BaseOffset | list[BaseOffset]] | None = None, | ||
| offset: BaseOffset | list[BaseOffset] | None = None, | ||
| observance: Callable | None = None, | ||
| start_date=None, | ||
| end_date=None, | ||
| | @@ -235,22 +235,17 @@ class from pandas.tseries.offsets, default None | |
| """ | ||
| if offset is not None and observance is not None: | ||
| raise NotImplementedError("Cannot use both offset and observance.") | ||
| if isinstance(offset, list) and any(isinstance(off, list) for off in offset): | ||
| raise ValueError( | ||
| "Nested lists are not supported for offset. " | ||
| "Flatten composite offsets of `Holiday.offset`s first." | ||
| ||
| ) | ||
| | ||
| self.name = name | ||
| self.year = year | ||
| self.month = month | ||
| self.day = day | ||
| self.offset: None | BaseOffset | list[BaseOffset] | ||
| if isinstance(offset, list): | ||
| self.offset = [] | ||
| for off in offset: | ||
| # check if we are handling composite offsets of another holiday | ||
| if isinstance(off, list): | ||
| self.offset.extend(off) | ||
| else: | ||
| self.offset.append(off) | ||
| else: | ||
| self.offset = offset | ||
| self.offset = offset | ||
| self.start_date = ( | ||
| Timestamp(start_date) if start_date is not None else start_date | ||
| ) | ||
| | ||
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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.