For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 1 1 2

Hi, i want to run in a dateframe calculations which include the RIC "EUR=". This causes an error where = is part of the python language. How can I work around this? Below my example df['COALEUR']=df.TRAPI2YZ0/(df.EUR=)

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonrics
icon clock
10 |1500

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

Upvote
Accepted
39.2k 75 11 27

Selection using attribute operator in a pandas dataframe may be convenient in some cases, but it's not universally applicable as attribute operator has shortcomings like the one you encountered: it cannot be used when column label contains special characters such as a white space or an equals sign. Use index operator rather than attribute operator:

df['COALEUR'] = df['TRAPI2YZ0'] / df['EUR=']
Or if you prefer rename the column, then use attribute operator.
df.rename(columns={'EUR=': 'EUR'}, inplace=True)
df['COALEUR'] = df.TRAPI2YZ0 / df.EUR
icon clock
10 |1500

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

Thanks Alex, this solved the issue.

Upvote
9.7k 49 38 60

Hi @w.jorissen,

The Eikon Data API uses the publicly available pandas.dataframe quite heavily and if you need to start manipulating or performing calculations I would suggest you refer to the documentation as a general guide.

You have not provided enough information to understand what you are attempting to calculate, but the way you want to access data from the data frame is invalid. For example, if you request for values related to the 'EUR=', you can't simply say: df.EUR=. You have to use a different syntax to get specific values from the dataframe, for example df.loc[0] for example.

icon clock
10 |1500

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

Click below to post an Idea Post Idea