question

Upvotes
Accepted
54 1 0 5

How can one define empty (NULL) fields in a Python request for Refinitiv Data Library?

The Python command


df=rd.get_data('AAPL.OQ', ['TR.ISINCode', , , 'TR.InstrumentType'])


returns a syntax error.

What I would like to do is for formatting purposes to have some empty (NULL) fields between the fields TR.ISINCode and TR.InstrumentType. How can empty fields be specified?

#technologypython 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
Upvote
Accepted
23.7k 61 15 21

Hi @IoannisG,

Its always a good idea to separate the data from display. You cannot add null fields into the request and it is not a good idea anyways. Formatting the displayed data should be done with dataframe. Pandas has couple of options for column width settings which you can utilize.

You can even iterate over the dataframe and write your own data render routines, in the manner that you prefer.

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.

Hi @IoannisG ,

As Gurpreet mentionned, you can use Pandas functions to rework a result.
This example will insert an empty column between TR.ISINCode and TR.InstrumentType:

df = rd.get_data('AAPL.OQ', ['TR.ISINCode', 'TR.InstrumentType'])
df.insert(1, "", "")	

But columns are unique so you can't do this insert twice.

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.