mortada / fredapi

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

'Timestamp' object #23

Closed chasefrench closed 5 years ago

chasefrench commented 5 years ago

Hi,

Firstly, thank you to anyone that can help me solve this issue.

I am using Anaconda2.7 with Spyder. I have installed pandas and fredapi through the Anaconda Promp using 'Conda install pandsas' and 'Conda install fredapi' You can see this at the bottom of the attachment.

I can confirm that some things work because the "get_series_info('GDP')" does return the correct information.

However, when using the command "get_series('GDP')" I continually get the following error:

File "G:/Financial Modelling/Python Scripts/LIBOR3M.py", line 11, in s = fred.get_series('SP500')

File "C:\Users\Chase.French\AppData\Local\Continuum\anaconda2\lib\site-packages\fredapi\fred.py", line 129, in get_series data[self._parse(child.get('date'))] = val

File "C:\Users\Chase.French\AppData\Local\Continuum\anaconda2\lib\site-packages\fredapi\fred.py", line 64, in _parse return pd.to_datetime(date_str, format=format).to_datetime()

AttributeError: 'Timestamp' object has no attribute 'to_datetime'

I would really appreciate any help that can be provided!

conda installation
chasefrench commented 5 years ago

Hopefully, this information should also help:

INSTALLED VERSIONS

commit: None python: 2.7.15.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 158 Stepping 10, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: None.None

pandas: 0.23.4 pytest: 3.9.1 pip: 18.1 setuptools: 36.5.0.post20170921 Cython: 0.29.2 numpy: 1.15.4 scipy: 1.1.0 pyarrow: None xarray: None IPython: 5.8.0 sphinx: 1.8.2 patsy: 0.5.1 dateutil: 2.7.5 pytz: 2018.7 blosc: None bottleneck: 1.2.1 tables: 3.4.4 numexpr: 2.6.8 feather: None matplotlib: 1.5.1 openpyxl: 2.5.12 xlrd: 1.2.0 xlwt: 1.3.0 xlsxwriter: 1.1.2 lxml: 4.2.5 bs4: 4.6.3 html5lib: 1.0.1 sqlalchemy: 1.2.15 pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None

chasefrench commented 5 years ago

The code I am runnning is, (I have removed my API Key

from fredapi import Fred import pandas as pd fred = Fred(api_key='6f328bfd8c0347f8cdc2104689085ef8') s = fred.get_series('SP500') s.tail()

Again, any assistance is really appreciated.

mortada commented 5 years ago

what version of the fredapi are you using? if you use the latest this error shouldn't happen

chasefrench commented 5 years ago

Thank you for responding. I fixed the problem by uninstalling anaconda and all python versions from my computer. Then do a clean install of 3.7.2 then using pip to install fredapi.

Have had no problems since.

mortada commented 5 years ago

glad to hear!