Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 2 2 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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apirics
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.

Upvote
Accepted
39.4k 77 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 512.0 KiB each and 1.0 MiB total.

Thanks Alex, this solved the issue.

Upvote
17.2k 82 39 63

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 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.