mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-09 11:19:23 +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)
|
fields[field_name] = pd.DataFrame.from_dict(values_per_sid)
|
||||||
|
|
||||||
data = pd.Panel.from_dict(fields, orient='items')
|
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
|
return data
|
||||||
|
|
||||||
def handle_remove(self, event):
|
def handle_remove(self, event):
|
||||||
|
|||||||
Reference in New Issue
Block a user