Skip to content

Commit 8289d59

Browse files
Joe Jevnikllllllllll
authored andcommitted
MAINT: improve error message in pipeline engine for misaligned dates
1 parent 27e6abc commit 8289d59

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

zipline/pipeline/engine.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,19 @@ def _compute_root_mask(self, start_date, end_date, extra_rows):
379379
include_start_date=False
380380
)
381381

382-
assert lifetimes.index[extra_rows] == start_date
383-
assert lifetimes.index[-1] == end_date
382+
if lifetimes.index[extra_rows] != start_date:
383+
raise ValueError(
384+
'The first date of the lifetimes matrix does not match the'
385+
' start date of the pipeline. Did you forget to align the'
386+
' start_date to the trading calendar?'
387+
)
388+
if lifetimes.index[-1] != end_date:
389+
raise ValueError(
390+
'The last date of the lifetimes matrix does not match the'
391+
' start date of the pipeline. Did you forget to align the'
392+
' end_date to the trading calendar?'
393+
)
394+
384395
if not lifetimes.columns.unique:
385396
columns = lifetimes.columns
386397
duplicated = columns[columns.duplicated()].unique()

0 commit comments

Comments
 (0)