Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Verify Press Release Claims | Automation and Content Analysis in the Newsroom
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for Journalists and Media

bookChallenge: Verify Press Release Claims

Automated fact-checking is an essential tool for journalists aiming to verify information quickly and accurately. When a press release claims the completion of several projects, it is critical to cross-check these claims against official data sources. By using Python, you can automate this verification process, reducing manual effort and minimizing errors. This approach not only speeds up reporting but also enhances the credibility of your work by systematically identifying inconsistencies.

12345678910111213141516171819202122232425262728293031
import pandas as pd # Predefined press release data press_release_data = [ {"project_id": 1, "project_name": "Riverwalk Extension", "completion_date": "2024-06-15"}, {"project_id": 2, "project_name": "Downtown Park", "completion_date": "2024-05-30"}, {"project_id": 3, "project_name": "Library Renovation", "completion_date": "2024-07-01"} ] # Predefined official project database official_database = [ {"project_id": 1, "project_name": "Riverwalk Extension", "completion_date": "2024-06-15"}, {"project_id": 2, "project_name": "Downtown Park", "completion_date": "2024-06-01"}, {"project_id": 3, "project_name": "Library Renovation", "completion_date": "2024-07-01"} ] # Convert lists to DataFrames df_press = pd.DataFrame(press_release_data) df_official = pd.DataFrame(official_database) # Merge DataFrames on project_id merged = pd.merge(df_press, df_official, on="project_id", suffixes=('_press', '_official')) # Find mismatches in completion dates discrepancies = merged[merged["completion_date_press"] != merged["completion_date_official"]] if not discrepancies.empty: print("Discrepancies found between press release and official database:") print(discrepancies[["project_id", "project_name_press", "completion_date_press", "completion_date_official"]]) else: print("No discrepancies found. All project completion dates match.")
copy

Automating checks like these helps you catch errors or inconsistencies that might otherwise go unnoticed. By systematically comparing data from press releases to official records, you can quickly identify discrepancies and ensure your reporting is based on accurate, verified information. This process not only saves time but also strengthens the reliability of your newsroom's fact-checking workflow.

Task

Swipe to start coding

Write a Python script to verify the accuracy of project completion dates listed in a press release by comparing them to an official project database.

  • Convert the press_release_data and official_database lists to pandas DataFrames.
  • Merge the two DataFrames on project_id.
  • Identify and report any projects where the completion date differs between the press release and the official database.
  • If there are no discrepancies, output a message indicating all dates match.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 5
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain how the code identifies discrepancies?

What should I do if discrepancies are found?

Can this approach be adapted for other types of data verification?

close

bookChallenge: Verify Press Release Claims

Swipe to show menu

Automated fact-checking is an essential tool for journalists aiming to verify information quickly and accurately. When a press release claims the completion of several projects, it is critical to cross-check these claims against official data sources. By using Python, you can automate this verification process, reducing manual effort and minimizing errors. This approach not only speeds up reporting but also enhances the credibility of your work by systematically identifying inconsistencies.

12345678910111213141516171819202122232425262728293031
import pandas as pd # Predefined press release data press_release_data = [ {"project_id": 1, "project_name": "Riverwalk Extension", "completion_date": "2024-06-15"}, {"project_id": 2, "project_name": "Downtown Park", "completion_date": "2024-05-30"}, {"project_id": 3, "project_name": "Library Renovation", "completion_date": "2024-07-01"} ] # Predefined official project database official_database = [ {"project_id": 1, "project_name": "Riverwalk Extension", "completion_date": "2024-06-15"}, {"project_id": 2, "project_name": "Downtown Park", "completion_date": "2024-06-01"}, {"project_id": 3, "project_name": "Library Renovation", "completion_date": "2024-07-01"} ] # Convert lists to DataFrames df_press = pd.DataFrame(press_release_data) df_official = pd.DataFrame(official_database) # Merge DataFrames on project_id merged = pd.merge(df_press, df_official, on="project_id", suffixes=('_press', '_official')) # Find mismatches in completion dates discrepancies = merged[merged["completion_date_press"] != merged["completion_date_official"]] if not discrepancies.empty: print("Discrepancies found between press release and official database:") print(discrepancies[["project_id", "project_name_press", "completion_date_press", "completion_date_official"]]) else: print("No discrepancies found. All project completion dates match.")
copy

Automating checks like these helps you catch errors or inconsistencies that might otherwise go unnoticed. By systematically comparing data from press releases to official records, you can quickly identify discrepancies and ensure your reporting is based on accurate, verified information. This process not only saves time but also strengthens the reliability of your newsroom's fact-checking workflow.

Task

Swipe to start coding

Write a Python script to verify the accuracy of project completion dates listed in a press release by comparing them to an official project database.

  • Convert the press_release_data and official_database lists to pandas DataFrames.
  • Merge the two DataFrames on project_id.
  • Identify and report any projects where the completion date differs between the press release and the official database.
  • If there are no discrepancies, output a message indicating all dates match.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 5
single

single

some-alt