mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-06 05:14:38 +08:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user