When I run the below; it does not return a date.
fye_date = ds.get_data(tickers='R:ABGJ', fields=['WC05350'], kind=1, start = '2005-12-31', end = '2020-07-31', freq = 'Y')
fye_date
How does one interpret this as a date in python?
@Josiah
It is expected behavior as mentioned in this thread. I found the code used to convert JSON date format to Python date in the DataStreamDSWS library.
import reimport datetimeimport pytzimport tracebackdef get_Date(jsonDate): try: match = re.match(r"^(/Date\()(-?\d*)([+-])(..)(..)(\)/)", jsonDate) if match: d = float(match.group(2)) ndate = datetime.datetime(1970,1,1) + datetime.timedelta(seconds=float(d)/1000) utcdate = pytz.UTC.fromutc(ndate).strftime('%Y-%m-%d') return utcdate else: raise Exception("Invalid JSON Date") except Exception: print("_get_token : Exception Occured") print(traceback.sys.exc_info()) print(traceback.print_exc(limit=2)) return None
Then, I used this method to convert the WC05350 column.
fye_date = ds.get_data(tickers='R:ABGJ', fields=['WC05350'], kind=1, start = '2005-12-31', end = '2020-07-31', freq = 'Y')fye_date[('R:ABGJ', 'WC05350')] = list(map(get_Date, fye_date[('R:ABGJ', 'WC05350')].values))fye_date