mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 17:51:22 +08:00
Merge pull request #28 from quantopian/fix-nans-in-transforms
Fills in missing slots in transform data panels.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user