mirror of
https://github.com/wassname/catalyst.git
synced 2026-10-28 12:51:29 +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:
1 parent
d3ade5050c
commit
5c883659b5
1 file changed
+12
-7
@@ -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