I got an error in the tutorial when I cloned the notebook from Pipeline Tutorial - Lesson 3
. Other people also got similar errors, as listed here (https://www.quantopian.com/posts/keyerror-on-pipeline-tutorial-lesson-5). I don't know enough about Python, but could it be that there is an extra comma on line 397 of run_pipeline
? Also, I have no idea who should fix this. Thanks for your support.
My code looks like:
def make_pipeline():
mean_close_10 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=10)
return Pipeline(
columns={
'10_day_mean_close': mean_close_10
}
)
result = run_pipeline(make_pipeline(), '2015-05-05', '2015-05-05')
result.head()
The resulting error looks like:
KeyError Traceback (most recent call last)
in ()
----> 1 result = run_pipeline(make_pipeline(), '2015-05-05', '2015-05-05')
2 result.head()
/build/src/extensions/extensions/main.py in run_pipeline(pipeline, start_date, end_date)
396 start_date=adjust_date,
397 end_date=adjust_date,
--> 398 )
399 def run_pipeline(pipeline, start_date, end_date):
400 """
/build/src/extensions/extensions/main.py in run_pipeline(pipeline, start_date, end_date)
404 PipelineEngine.run_pipeline.
405 """
--> 406 return engine.run_pipeline(pipeline, start_date, end_date)
407 return run_pipeline
408
/build/src/qexec_repo/zipline_repo/zipline/pipeline/engine.pyc in run_pipeline(self, pipeline, start_date, end_date)
171 dates,
172 assets,
--> 173 initial_workspace={self._root_mask_term: root_mask_values},
174 )
175
/build/src/qexec_repo/zipline_repo/zipline/pipeline/engine.pyc in compute_chunk(self, graph, dates, assets, initial_workspace)
352 loader = get_loader(term)
353 loaded = loader.load_adjusted_array(
--> 354 to_load, mask_dates, assets, mask,
355 )
356 workspace.update(loaded)
/build/src/qexec_repo/zipline_repo/zipline/pipeline/loaders/equity_pricing_loader.pyc in load_adjusted_array(self, columns, dates, assets, mask)
75 start_date,
76 end_date,
---> 77 assets,
78 )
79 adjustments = self.adjustments_loader.load_adjustments(
/build/src/qexec_repo/qexec/sources/resource_proxy.pyc in method(self, args, **kwargs)
134 def method(self, *args, **kwargs):
135 with self.resource as proxied:
--> 136 return getattr(proxied, name)(args, **kwargs)
137 return method
138
/build/src/qexec_repo/zipline_repo/zipline/data/us_equity_pricing.pyc in load_raw_arrays(self, columns, start_date, end_date, assets)
560 def load_raw_arrays(self, columns, start_date, end_date, assets):
561 # Assumes that the given dates are actually in calendar.
--> 562 start_idx = self._calendar.get_loc(start_date)
563 end_idx = self._calendar.get_loc(end_date)
564 first_rows, last_rows, offsets = self._compute_slices(
/build/src/qexec_repo/zipline_repo/zipline/utils/memoize.pyc in get(self, instance, owner)
51 return self._cache[instance]
52 except KeyError:
---> 53 self._cache[instance] = val = self._get(instance)
54 return val
55
/build/src/qexec_repo/zipline_repo/zipline/data/us_equity_pricing.pyc in calendar(self)
472 @lazyval
473 def _calendar(self):
--> 474 return DatetimeIndex(self.table.attrs['calendar'], tz='UTC')
475
476 @lazyval
/usr/local/lib/python2.7/dist-packages/bcolz/attrs.pyc in getitem(self, name)
93
94 def getitem(self, name):
---> 95 return self.attrs[name]
96
97 def setitem(self, name, obj):
KeyError: 'calendar'