Skip to content
2 min read plotly plotting csv multiple-files

Bamboo Weekly #185: US-Canada trade

Get better at: Working with multiple CSV files, and plotting with Plotly.

Bamboo Weekly #185: US-Canada trade

The US has launched a trade war against Canada, imposing tariffs of 50 percent on about $20 billion in goods. And Canada, angered by this sort of behavior from one of its longest-standing allies and trade partners, has responded in kind, with high tariffs against US products (https://www.nytimes.com/2026/08/26/world/canada/carney-canada-trump-tariffs-retaliate.html?unlocked_article_code=1.8VA.peRW.DR9qdIs7xfTq&smid=url-share). The Trump administration claims that the tariffs are in response to unfair trade treatment on the part of Canadians.

Paul Krugman's take on this is not only insightful from an economic perspective, but also because of his recent newsletter issue's title, "The Moose that Roared" (https://paulkrugman.substack.com/p/the-moose-that-roared).

This week, we'll look at trade between Canada and the United States. We'll try to understand what the countries trade, how much they trade, which portions of each country export and import the most, and how trade varies over the course of the year.

Data and five questions

This week's data comes from the Bureau of Transportation Statistics, whose transborder data is of particular use here:

https://www.bts.gov/topics/transborder-raw-data

They post a new zipfile every month -- most recently from June 2026 -- containing three CSV files describing the trade. We'll be looking at the second file (dot2) from each month, which lists what is being traded, the US state and Canadian province. We'll look at data from the 12 most recent downloadable files, from July 2025 through June 2026.

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 working with multiple files, grouping, pivot tables, and plotting with Plotly.

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