Skip to content
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
 updated exclude_dates to be [Timestamp] in constructor
  • Loading branch information
sharkipelago committed Jun 10, 2025
commit f019a5c3cb9025a8d3d8f33107a5bfff5874e7ab
10 changes: 4 additions & 6 deletions pandas/tseries/holiday.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
)
from typing import (
TYPE_CHECKING,
Any,
)
import warnings

Expand Down Expand Up @@ -172,7 +171,7 @@ def __init__(
start_date=None,
end_date=None,
days_of_week: tuple | None = None,
exclude_dates: list[Any] | None = None,
exclude_dates: list[Timestamp] | None = None,
Copy link
Member

Choose a reason for hiding this comment

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

Actually, can we type this as exclude_dates: DatetimeIndex | None = None,?

) -> None:
"""
Parameters
Expand Down Expand Up @@ -264,11 +263,10 @@ class from pandas.tseries.offsets, default None
self.observance = observance
assert days_of_week is None or type(days_of_week) == tuple
Copy link
Contributor Author

@sharkipelago sharkipelago Jun 10, 2025

Choose a reason for hiding this comment

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

Should I also switch this to throw a ValueError on failing? Or would that be a separate PR?

Copy link
Member

Choose a reason for hiding this comment

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

A separate PR would be better, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this, should I open a new issue? Or just make another PR?

Copy link
Member

Choose a reason for hiding this comment

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

Just another PR is fine

self.days_of_week = days_of_week
self.exclude_dates = (
[Timestamp(ex) for ex in exclude_dates]
if exclude_dates is not None
else exclude_dates
assert exclude_dates is None or all(
type(ex) == Timestamp for ex in exclude_dates
)
self.exclude_dates = exclude_dates

def __repr__(self) -> str:
info = ""
Expand Down