Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'module' object has no attribute 'TimeSeries' after python Validation.py

Just starting Computational Investing by Tucker Balch. I'm using virtualbox and installed Ubuntu. After installing QSTK, I ran python Validation.py (Step 7). I keep getting an:

AttributeError: 'module' object has no attribute 'TimeSeries'

There are many similar questions so I believe problem is the use of the same name as the file somewhere in the code. I was wondering if anyone had a solution specific to this class and QSTK.

The full error is:

Traceback (most recent call last):
 File "Validation.py", line 122 in <module>
  import QSTK.qstkutil.tsutil as tsu
 File "usr/local/lib/python2.7/dist-packages/QSTK-0.2.8 py2.7.egg/QSTK/qstkutil/tsutil.py", line 19, in <module>
  from QSTK.qstkutil import qsdateutil
 File "usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstkutil/qsdateutil.py", line 38, in <module>
  GTS_DATES = _cache_dates()
 File "usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstkutil/qsdateutil.py", line 36, in _cache_dates
  return pd.TimeSeries(index=dates, data=dates) 
AttributeError: 'module' object has no attribute 'TimeSeries' 
like image 697
forrest pump Avatar asked Jan 03 '23 18:01

forrest pump


2 Answers

I encountered this issue too. This caused by the pandas lib. You can get into the path(my file path is /Library/Python/2.7/site-packages/QSTK/qstkutil) where the qstkutil.py of QSTK located. Then change all the 'TimeSeries' of this file as 'Series'.

You can also get some insights from here(https://github.com/QuantSoftware/QuantSoftwareToolkit/issues/73)

like image 128
Kate Avatar answered Jan 06 '23 10:01

Kate


Corley is spot on. You can solve the problem by changing 2 occurrences of "TimeSeries" to "Series" in /usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstkutil/qsdateutil.py. "TimeSeries" also appears once in /usr/local/lib/python2.7/dist-packages/QSTK-0.2.8-py2.7.egg/QSTK/qstkutil/tsutil.py but I haven't encountered an error yet due to it.

like image 36
D Scott Avatar answered Jan 06 '23 09:01

D Scott