Skip to content

Commit ce01eeb

Browse files
authored
fix obscure pandas bug (#230)
1 parent c3c2270 commit ce01eeb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

server/chalicelib/aggregation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
def train_peak_status(df):
1212
cal = USFederalHolidayCalendar()
1313
holidays = cal.holidays(start=df['dep_dt'].min(), end=df['dep_dt'].max())
14+
# pandas has a bug where sometimes empty holidays returns an Index and we need DateTimeIndex
15+
holidays = pd.to_datetime(holidays)
1416
df['holiday'] = df['service_date'].isin(holidays.date)
1517

1618
# Peak Hours: non-holiday weekdays 6:30-9am; 3:30-6:30pm

0 commit comments

Comments
 (0)