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
46 7 9 8

Pull news headlines together with RIC or ISIN identifier

Dear support,

For pulling news headlines for a specific universe we currently make a list of RICs, and use a for loop to iterate over them and get headlines for all the RICs in the list.

The outputted data frame has more than one news headline for each company. We would like to add an adjacent column to the output with the pertinent identifier (RIC or ISIN). To be able to know what company the headlines pertain to. Could you help us figure out how to add that to the for loop using the ek.get_news_headlines function?


Thanks in advance


See our current code below:

df1 = pd.DataFrame()

RIC_List

for ric in RIC_List:

q='R:'+ ric + ' AND Topic:ESG AND Language:LEN'

#print(q)

df = ek.get_news_headlines(q,count=3, date_from='2020-09-15T09:00:00', date_to='2020-10-08T18:00:00')

df1 = df1.append(df)

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apiricsnews
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
10.6k 20 6 9

H @Erik77 - so the best place to do this is right after you get the return from the API, see below:

RIC_List = ['VOD.L','IBM.N']
df1 = pd.DataFrame()
RIC_List

for ric in RIC_List:
    q='R:'+ ric + ' AND Topic:ESG AND Language:LEN'
    df = ek.get_news_headlines(q,count=3, date_from='2020-09-15T09:00:00', date_to='2020-10-08T18:00:00')
    df['RIC1'] = ric
    df1 = df1.append(df)

I hope this can help.


1608247300884.png (196.0 KiB)
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.