From 5c883659b5b6dcd2053b312f08476aa9aeeecbf8 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Tue, 7 May 2013 18:17:08 -0400 Subject: [PATCH] BUG: Fix missing values from supplemental data in batch transform. Adapt the supplemental data fill so that it works with the new shape of the batch transform that was switched to with the rolling panel optimizations. --- zipline/transforms/utils.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/zipline/transforms/utils.py b/zipline/transforms/utils.py index d2154253..b28fea8c 100644 --- a/zipline/transforms/utils.py +++ b/zipline/transforms/utils.py @@ -501,14 +501,19 @@ class BatchTransform(object): data = self.rolling_panel.get_current() if self.supplemental_data: - # item will be a date stamp for item in data.items: - try: - data[item] = self.supplemental_data[item].combine_first( - data[item]) - except KeyError: - # Only filling in data available in supplemental data. - pass + # axes[1] (minor axis) will be a date stamp + for dt in data.axes[1]: + try: + supplemental_for_date = self.supplemental_data[dt] + except KeyError: + # Only filling in data available in supplemental data. + supplemental_for_date = None + + if supplemental_for_date is not None: + data[item].ix[dt] = \ + supplemental_for_date.ix[item].combine_first( + data[item].ix[dt]) if self.clean_nans: # Fills in gaps of missing data during transform