question

Upvotes
1 0 0 0

Filtering ECB-Related News from News Archive in Pandas DataFrame


Message:

Hello,

I am currently working on filtering a large dataset containing Reuters news from the past 20 years, which I've loaded into a Pandas DataFrame. The dataset has over 2 million news records, sourced monthly from an SFTP server. My objective is to isolate news items related to the European Central Bank (ECB) and their interest rate decisions.

Details:

I am specifically looking to filter out articles tagged with "ECB" or "M:I" in the data.subjects column, but exclude any tagged with "ECB/INT".

Current Method:My current approach uses the following Pandas code snippet:

df_clean = df[
    (df['data.subjects'].str.contains('M:I|ECB', na=False)) &
    (~df['data.subjects'].str.contains('ECB/INT', na=False))
]

Issue:Despite these tags being standard and correctly formatted according to the official guide, the filter returns an empty DataFrame, and there are no error messages that indicate what might be wrong.

Questions:

  1. Is there an error in how I'm applying the filter conditions?
  2. Could there be an unseen issue with how the DataFrame is structured or how the data is being read into Pandas?

Any assistance in adjusting the code or troubleshooting this issue would be greatly appreciated.

Thank you!

python#technologynews-topic-code-list
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
80.1k 257 52 75

@marc.sieber

Thank you for reaching out to us.

From the question, I assume that you are using the News Archive product.

This forum is dedicated to software developers using Refinitiv APIs. The moderators on this forum do not have deep expertise in every bit of content available through Refinitiv products.

Please kindly contact the product support team directly via MyRefinitiv. The support team can verify and answer this question.


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.