mortada / fredapi

Python API for FRED (Federal Reserve Economic Data) and ALFRED (Archival FRED)
Apache License 2.0
930 stars 160 forks source link

FredDL.py 32 get_series C:\Python27\lib\site-packages\fredapi\fred.py 132 _parse C:\Python27\lib\site-packages\fredapi\fred.py 65 exceptions.AttributeError: 'datetime.datetime' object has no attribute 'to_datetime' #4

Closed ErkanCDU closed 9 years ago

ErkanCDU commented 9 years ago

Just a standard example gives an error: from fredapi import Fred fred = Fred(api_key='..') data = fred.get_series('GDP')

tried restarting and playing around with various date import commands, but the simple code

gives the error output:

Traceback (most recent call last): File "", line 254, in run_nodebug File "..FredDL.py", line 32, in data = fred.get_series('GDP') File "C:\Python27\lib\site-packages\fredapi\fred.py", line 132, in get_series data[self._parse(child.get('date'))] = val File "C:\Python27\lib\site-packages\fredapi\fred.py", line 65, in _parse return to_datetime(date_str, format=format).to_datetime() AttributeError: 'datetime.datetime' object has no attribute 'to_datetime'

mortada commented 9 years ago

that's weird - this actually works fine for me. What version of fredapi are you using?

mortada commented 9 years ago

Oh ... I think this is probably because you are on an older version of pandas, what's your pandas version?

mortada commented 9 years ago

@ErkanCDU upgrading to fredapi 0.3.6 should fix your issue.

ErkanCDU commented 9 years ago

Hi,

thanks for the quick comments. I am now convinced that something is wrong with my system. After reinstalling the packages, a different error pops up. I will let you know when I have found the solution

Traceback (most recent call last): File "", line 254, in run_nodebug File "C:\Users\Erkki\Dropbox_JmpCode\Data\NewsAnal\ProcessNewsAnal\TimeVaryingRegressionSparsity\Korobilis\FredDL.py", line 32, in data = fred.get_series('GDP') File "C:\Python27\lib\site-packages\fredapi\fred.py", line 113, in get_series from pandas import to_datetime, Series File "C:\Python27\lib\site-packages\pandasinit.py", line 7, in from pandas import hashtable, tslib, lib File "pandas\src\numpy.pxd", line 865, in init pandas.hashtable (pandas\hashtable.c:23780) ValueError: numpy.ufunc has the wrong size, try recompiling

mortada commented 9 years ago

Ah I see, does seem like a problem on your system. I'd recommend using Anaconda to manage your python modules https://store.continuum.io/cshop/anaconda/

ErkanCDU commented 9 years ago

The version control was indeed the issue, after reinstalling everything (via Anaconda as you suggested, it works now). Thanks. Case closed.