At the end of April, Reporters Without Borders (known by its French acronym, RSF) released their annual report on press freedom in countries around the world (https://rsf.org/en/video-2026-rsf-world-press-freedom-index). The state of affairs isn't so great; for the first time, more than half of the countries in the world were ranked "difficult" or "very serious." The scores for a number of countries declined fairly significantly.
This week, we'll examine the data, seeing where things have improved, where they have declined, and if there are any places in which the RSF multi-faceted scoring can show some nuances.
Paid subscribers, both to Bamboo Weekly and to my LernerPython+data membership program (https://LernerPython.com) get all of the questions and answers, as well as downloadable data files, downloadable versions of my notebooks, one-click access to my notebooks, and invitations to monthly office hours.
Learning goals for this week include combining multiple files, multi-indexes, plotting with Plotly, and pivot tables.
Data and five questions
This week's data comes from RSF. The data itself is available in a few places. I chose to retrieve it from a GitHub repo at https://github.com/dw-data/world-press-freedom-2026/tree/main . The files we want to use are in the csvs/rsf-files subdirectory.
Here are my five questions for this week. I'll be back tomorrow with solutions and explanations:
- Download the GitHub repo with the data. Create a single Pandas data frame from the CSV files in the
rsf-filessubdirectory, reading data from 2022 - 2026. (The directory contains more files than just these, but there was a major change in methodology starting in 2022, so we'll ignore earlier files.) You will have to deal with file-encoding issues when importing the files. Make sure that the score columns are treated as floats. Remove theCountry_*columns, as well as theScore 2026andScore 2025columns. Make the index a two-level multi-index fromISOandYear(which you should rename fromYear (N)). - The
Scorecolumn isn't assigned in 2025 and 2026 data. Calculate it as the mean of thePolitical Context,Economic Context,Legal Context,Social Context, andSafetycolumns. Which 10 countries have the highest overall press-freedom score for 2026? Which 10 countries have the lowest scores?