Skip to content
3 min read · Tags: datetime correlations plotting excel seaborn window-functions

BW #109: Cacao nibs

Get better at: Excel files, dates and times, correlations, plotting with Seaborn, and window functions

BW #109: Cacao nibs

For several years now, cacao nibs have been a staple in our house. I put them in yogurt and oatmeal, where they add chocolatey flavor and a crunch texture. (In case you're wondering, "cacao" refers to raw beans, while "cocoa" refers to roasted ones. In practice, the terms are often mixed up.)

Earlier this year, I asked the owner of our local fancy-food store when she would get more cacao nibs. She said that there's a world-wide cacao shortage, and chocolate manufacturers are buying up whatever they can find, leaving little or nothing for the companies selling beans and nibs. Another store had one bag left in stock, and agreed that no new shipments are on the horizon.

I've made some trips to both stores since then, and it would seem that the cacao-nib crisis is real. And sure, you could argue that the crunchiness of my yogurt doesn't rank up there with the world's many challenges.

But cocoa is one of the products commonly traded at commodity markets around the world. (Other common products are coal, coffee, beef, sugar, and cotton.) The World Bank tracks certain commodities to know (roughly) how prices are moving around the world. I thus thought that this would be a good opportunity not just to trade cocoa prices over the last months and years, but to compare them with other commodities. After all, maybe cocoa prices have risen, but other prices have risen even more. Which won't bring them back to my local stores, but will help me feel a bit better.

Data and five questions

This week, we'll look at monthly commodities data published by the World Bank. This data is often described as the "pink sheet," because it was originally published on pink-colored paper. More formally, the data is known as the "Commodity markets outlook," whose main Web site is at

https://www.worldbank.org/en/research/commodity-markets

You'll want to download the monthly data, which is in the form of an Excel spreadsheet:

https://thedocs.worldbank.org/en/doc/18675f1d1639c7a34d463f59263ba0a2-0050012025/related/CMO-Historical-Data-Monthly.xlsx

Note that there is also a link to download a spreadsheet of annual prices, which we won't be using.

Paid subscribers can download the data files from a link at the bottom of this message.

I'll be back tomorrow with my solutions, including (for paid subscribers) a downloadable copy of the Jupyter notebook I used to solve these problems, as well as a one-click link to open that notebook (and the data) in Google Colab.

This week's learning goals include parsing date-time data, working with Excel files, window functions, and plotting with Seaborn.

Here are my five tasks and questions for you: