BW #50: Red Sea shipping
With Houthi rebels firing at ships entering the Red Sea, shipping through that region has been disrupted. This week, we look at the number of ships going (and not going) through the Suez Canal.
We're now more than three months into the war between Israel and Hamas. While I have many thoughts on the war, this issue focuses on an unexpected war-related development, specifically, the Houthi rebels in Yemen expressing their solidarity with Hamas by attacking ships in the Red Sea. (They claim to be attacking ships that are owned by or trading with Israel, but that turns out not to be the case.)
Shipping companies are now paying more in insurance to go through the Red Sea, or they're rerouting their ships to go around the Cape of Good Hope in South Africa. Either way, it would seem that these Yemeni rebels' actions are responsible for a rise in inflation.
NPR's Planet Money reported on this topic earlier this month (https://www.npr.org/2024/01/02/1197959330/red-sea-tensions-global-shipping), and Marketplace had a story on it as well (https://www.marketplace.org/2024/01/17/red-sea-attacks-houth-rebels-shipping-rates/).
This week, we'll look at how many ships normally travel through the Red Sea and Suez Canal, and how many appear to be rerouted.
Data and seven questions
This week's data comes from PortWatch (https://portwatch.imf.org/), a joint project between the International Monetary Fund and the University of Oxford that was launched in November. They aim to track ships and ports around the world, and to give us insights into what's happening on those fronts.
We'll look at three related data sets, all describing the traffic of cargo ships and oil tankers:
- The number of ships passing through Bab el Mandeb, the "Strait of Tears" at the entrance to the Red Sea
- The number of ships passing through the Suez Canal
- The number of ships going past the Cape of Good Hope, in South Africa.
All three of these can be downloaded from the PortWatch page, "Trade disruptions in the Red Sea" (https://portwatch.imf.org/pages/573013af3b6545deaeb50ed1cbaf9444). Click on the "export data" link next to each graph, and choose the CSV export. (The Excel export produces an HTML file, rather than an actual Excel file, despite the ".xls" extension.)
The learning goals for this week's questions include:
- Creating a single data frame from several files
- Working with date/time values, including resampling
- Window functions
- Plotting
Here are my seven tasks and questions for you this week. I'll be back tomorrow with my detailed solutions, including the Jupyter notebook I used to solve the problems myself:
- Create a dictionary of data frames, in which the keys are short (3-5 letter) nickname for the data source, and the values are data frames, one for each of the three CSV files. In each data frame, the original "DateTime" column should be the index, and parsed as a "datetime" dtype. Keep only the "Number of Cargo Ships" and "Number of Tanker Ships" columns, renamed to something shorter.
- Join these three data frames together into a single data frame with six columns (two from each of the original data frames).