> ## Content Index
> Fetch the complete content index at: https://www.bambooweekly.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Bamboo Weekly #81: School
- URL: https://www.bambooweekly.com/bw-81-school/
- Published: 2024-08-29T00:13:13.000Z
- Updated: 2026-08-30T06:00:04.000Z
- Description: Get better at: Grouping, pivot tables, sorting, plotting, and fitlering
- Author: Reuven M. Lerner
- Tags: grouping, pivot-table, sorting, plotting, filtering

It's late August – which means, at least for many people in the northern hemisphere, that a new school year has already begun, or will be starting soon. It's still fairly quiet at the schools I pass on my morning walk, including the upper school at the end of my street. But we know from years of experience that we're now in the calm before the storm. As of a few days from now, every morning will bring a new traffic jam to our street, and every afternoon will bring a sea of teenagers to our local shopping center.

With the start of school in the air, I thought it would be interesting and appropriate to look at education-related statistics for countries and regions from all over the world. 

### Data and six questions

This week's data comes from the World Bank ([https://worldbank.org](https://worldbank.org/?ref=bambooweekly.com)), which lends money to countries that want to invest in infrastructure and education. The data is from the World Bank's page for educational data, at:

```
https://data.worldbank.org/topic/education

```

To get the data, click on the "CSV" link on that page, or use the following link instead:

```
https://api.worldbank.org/v2/en/topic/4?downloadformat=csv

```

This will download a zipfile containing three CSV files to your computer. We'll use those files to answer a number of education-related questions. The files are:

- The data itself
- Metadata about the indicators
- Metadata about the countries

The filenames are all very long, but you can readily identify the metadata-related files, because their names start with the word "Metadata". The third file, whose name starts with API\_4, contains the main data.

This week's learning goals include joins, grouping plotting, and filtering columns and rows.

Here are my six questions and tasks for this week. I'll be back tomorrow with my complete answers, as well as a downloadable Jupyter notebook with my solutions:

- Import the main file into a data frame. Set its index to be the "Country Code" column, drop the "Unnamed: 68" column, and keep only those rows where "Indicator Code" starts with "SE.".
- Import the two metadata files into data frames, and join them together with the main data frame. Remove any columns that start with the word "Unnamed". Then make the country code into the index.
- What 10 countries had, in 2022, the highest percentage of female bachelor's degree or better?
- In 2022, what countries had the highest literacy rate for adult males and females? The lowest?
- For each region of the world, calculate the mean "Educational attainment, at least completed upper secondary, population 25+, total (%)", with a code of `SE.SEC.CUAT.UP.ZS`. Which region has had the greatest percentage improvement between 2002 and 2012, and 2012 and 2022? If the Region is `NaN`, then that means the row itself refers to a region, and can be excluded. Did any regions go down?
- Create a line plot showing, for each year, the mean government expenditure on education for each income group, as a percentage of GDP (SE.XPD.TOTL.GD.ZS). The years should form the x axis, and the expense the y axis. What directions do we see for rich countries vs. poor countries?

I'll be back tomorrow with my solutions. 

Reuven