Fills in missing slots in transform data panels.

Forward fills data, so that when using multiple stocks,
we don't have cases where one stock has data and the other doesn't.
This commit is contained in:
Eddie Hebert
2012-11-21 17:54:57 -05:00
parent 0ba6f88a84
commit 2c3d9a84db
+10
View File
@@ -454,6 +454,16 @@ class BatchTransform(EventWindow):
fields[field_name] = pd.DataFrame.from_dict(values_per_sid)
data = pd.Panel.from_dict(fields, orient='items')
# Fills in gaps of missing data during transform of multiple
# stocks.
# e.g. we may be missing minute data because of illiquidity
# of one stock
data = data.fillna(method='ffill')
# Drop any empty rows after the fill.
# This will drop a leading row of N/A
data = data.dropna()
return data
def handle_remove(self, event):