Skip to content

Commit 3cd16d0

Browse files
committed
make backwards compatible with older pandas versions without Timestamp object
1 parent b58f3fe commit 3cd16d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fredapi/fred.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ def _parse(self, date_str, format='%Y-%m-%d'):
6262
helper function for parsing FRED date string into datetime
6363
"""
6464
from pandas import to_datetime
65-
return to_datetime(date_str, format=format).to_datetime()
65+
rv = to_datetime(date_str, format=format)
66+
if hasattr(rv, 'to_datetime'):
67+
rv = rv.to_datetime()
68+
return rv
6669

6770
def get_series_info(self, series_id):
6871
"""

0 commit comments

Comments
 (0)