From f28982a7e5bb6ccc53307aee6358dc253c52e581 Mon Sep 17 00:00:00 2001 From: Joe Jevnik Date: Sat, 23 Jan 2016 15:27:42 -0500 Subject: [PATCH] BUG: do a notnull or notnan check based on the schema --- zipline/pipeline/loaders/blaze/core.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zipline/pipeline/loaders/blaze/core.py b/zipline/pipeline/loaders/blaze/core.py index 18b9faee..cc9482f2 100644 --- a/zipline/pipeline/loaders/blaze/core.py +++ b/zipline/pipeline/loaders/blaze/core.py @@ -138,6 +138,7 @@ from datashape import ( DateTime, Option, float64, + floating, isrecord, isscalar, promote, @@ -858,7 +859,14 @@ class BlazeLoader(dict): The query to run for the given column. """ colname = column.name - filtered = e[e[colname].notnull() & (e[TS_FIELD_NAME] <= lower_dt)] + pred = e[TS_FIELD_NAME] <= lower_dt + schema = e[colname].schema.measure + if isinstance(schema, Option): + pred &= e[colname].notnull() + schema = schema.ty + if schema in floating: + pred &= ~e[colname].isnan() + filtered = e[pred] lower = filtered.timestamp.max() if have_sids: