Python trading course: Section 3, Unit 6 - Sample code vs Rough coding area

Hi,

I run the same code in coding area with sample code however in sample code is correct but when run in rough coding area there is an error as below:

 
KeyErrorTraceback (most recent call last)
<ipython-input-5-083aa1f5034f> in <module>()
      4 data = get_data('AAPL')
      5 # Type your code below
----> 6 data['SMA10'] = pd.rolling_mean(data['Close'],10)
      7 data.iloc[-15:]

/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/frame.py in __getitem__(self, key)
   1967             return self._getitem_multilevel(key)
   1968         else:
-> 1969             return self._getitem_column(key)
   1970 
   1971     def _getitem_column(self, key):

/opt/conda/envs/python2/lib/python2.7/site-packages/pandas/core/frame.py in _getitem_column(self, key)
   1974         # get column
   1975         if self.columns.is_unique:
-> 1976             return self._get_item_cache(key)
   1977 
   1978         # duplicate columns & possible reduce dimensionality

Why is that ?

Hi Khairul,

This looks like a temporary issue with fetching data. Could you please refresh the page and try again?

Thanks!

Ishan

 

 

 

Thanks. It’s working now