Skip to content

Commit f46c394

Browse files
committed
raise ValueError if exclude_dates is not DatetimeIndex
1 parent 655ca4e commit f46c394

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/tseries/holiday.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ class from pandas.tseries.offsets, default None
260260
self.observance = observance
261261
assert days_of_week is None or type(days_of_week) == tuple
262262
self.days_of_week = days_of_week
263-
assert exclude_dates is None or type(exclude_dates) == DatetimeIndex
263+
if exclude_dates is not None and type(exclude_dates) != DatetimeIndex:
264+
raise ValueError("exclude_dates must be None or of type DatetimeIndex.")
264265
self.exclude_dates = exclude_dates
265266

266267
def __repr__(self) -> str:

0 commit comments

Comments
 (0)