question

Upvotes
Accepted

Python get_timeseries - Date TypeError: 'float' object is not callable

Hi


I am trying to run the bellow code:

'''

cpi = ek.get_timeseries(['USCPI=ECI'],start_date='2005-01-01', end_date = "2020-09-24", interval='monthly')

cpi=cpi.resample("D").mean()

cycle, trend=sm.tsa.filters.hpfilter(cpi, 6.25 (1600/4**4))

'''

Also,


When I read the ric and call the columns names it appears just [Value] and not the date column?

'''cpi.columns'''

How can I work date like a normal column?

eikon-data-apidatastream-apidsws-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
39.4k 77 11 27

The TypeError is due to the expression you pass to the lamb argument of hpfilter method. The value of this argument must be a float. You pass the expression "6.25 (1600/4**4)", which does not evaluate to a float. I suppose you must have copied and pasted it from the statsmodels documentation that suggests using the value of 6.25 for annual data, and provides that the value of 6.25 is arrived at by taking 1600 and dividing it by 4 to the power of 4 (1600/4**). In any case the error has nothing to do with Eikon Data APIs. It is returned by the line of code that doesn't utilize any Refinitiv software. This forum is dedicated to Eikon Data APIs. For questions about using statsmodels library you'd be better off using forums dedicated to that topic.

To answer your second question, get_timeseries method returns pandas dataframe indexed on the timestamp. To get the dates for the timeseries in your dataframe use cpi.index.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.