Skip to content

Bamboo Weekly #164: Fertilizer

Get better at: Scraping, regular expressions, grouping, plotting with Plotly, and handling dates and times.

Bamboo Weekly #164: Fertilizer

The Iran war has most famously affected the price of oil, because of the current holdup in the Strait of Hormuz. But oil's not the whole story: Persian Gulf countries also export a great deal of fertilizer via the strait. (As well as helium and even aluminum, it turns out.) In fact, these countries export so much fertilizer that there are worries about the price and/or availability of fertilizer for the world's farmers, just as planting season is starting in the northern hemisphere (https://www.nytimes.com/2026/03/27/business/economy/fertilizer-food-supply-iran-war.html?unlocked_article_code=1.XlA.uMGn.koU9YWXzVa3y&smid=url-share).

Why fertilizer? While we think of cow manure as the standard form of fertilizer, that hasn't been true for more than a century. The famous Haber-Bosch process combines nitrogen and hydrogen to create ammonia (NH₃), which can then be used to create urea, a nitrogen-rich fertilizer. You can get nitrogen from the air, but the hydrogen has to come from somewhere else, such as natural gas, which the Persian Gulf has in large quantities. The process is also energy intensive, which gives Persian Gulf countries another advantage, given their large petroleum and natural gas deposits.

According to the New York Times article I referenced earlier, the closing of the Strait of Hormuz has caused urea prices to skyrocket by 50 percent, and ammonia prices to rise by 20 percent. If you're a farmer buying fertilizer, that's a significant, unexpected expense you now have to bear.

This week, we'll look at fertilizer exports and imports, using data from FAO, the United Nations Food and Agriculture Organization (https://www.fao.org/). We'll see how much fertilizer comes from the Persian Gulf, and which countries depend on that fertilizer to grow their crops.

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 reading CSV files, pivot tables, grouping, filtering, multi-indexes, and plotting with Plotly.

Data and five questions

This week's data comes from the FAO, and specifically from FAOSTAT. The data-download page for fertilizer trade is at https://www.fao.org/faostat/en/#data/RFM ,

I went to this page, and clicked on the "all data" link, which downloaded a 41 MB zipfile to my computer. We'll use one of the files from there, the "all fertilizers trade matrix, no flag" CSV file.

Here are my five questions for this week. I'll be back tomorrow with my solutions and explanations: