Matt Harrison on what drew him to Polars, how he checks AI-assisted work, and why a mountain-bike crash became the starting point for his new course.

Matt Harrison opened his Strava export after a mountain-bike crash because he wanted to answer one question. Where on the trail had he crashed? That ride became the dataset for Modern Analytics with Polars, Rust, and AI, a course that takes one analysis from a Polars 1 notebook through a version upgrade and all the way to a Rust plugin another person can install.
Why did you choose your own bike ride for the course?
I was riding with a high school group, and I was at the very back. I passed out in the crash and don't remember much from that day. I remember waking up and continuing to ride. The group was waiting for me farther down the trail. I couldn't tell you exactly where I'd crashed, so I opened the Strava data to see if I could figure it out.
That's why I like teaching with this dataset. There was a reason I wanted to look at those timestamps and GPS readings. In the course, we start by calculating the distance between consecutive readings and adding up the intervals. We use that same calculation as we add tests, clean up the notebook, and upgrade Polars. If you work with time series, you'll face some of the same questions about the order of the readings and how to pair them.
You’d already written about pandas. What made you want to write a book about Polars?
I've worked with pandas for a long time. If you're working with small data and the pandas ecosystem has what you need, it can be a great choice. What caught my attention about Polars was that it took a fresh look at how a DataFrame library could work. It has a Rust backend, can use multiple cores, and has a query engine that can optimize a series of operations together.
I like that combination of a fast implementation and a scripting interface where I can try something quickly. We're seeing it in Python tooling too, with tools like uv, and I think we'll see more of it. If I'm spending a lot of time waiting on joins or grouped aggregations, Polars is one of the first tools I'll try. That's often where I see a worthwhile speedup.
What changed in the third edition?
I set out to update the examples for Polars 2.1 and show the practices I use today. I ended up touching or rewriting practically every piece of code. I also overhauled the plotting material and made a lot of new diagrams. If we're joining two tables or calculating a rolling window, I want you to be able to see which rows the operation uses. The book also walks through working with lists and structs inside a DataFrame and adding your own expressions in Python and Rust.

In the book’s time-series chapter, the 10:30 reading falls in both the 10:00 and 10:30 windows.
If you've read an earlier edition, I'd start with the CLEANER chapter. I've started teaching this framework to my clients, and you can use it with any tabular tool. CLEANER stands for Capture, Limit, Edit, Audit, Null, Engineer, and Restrict. If I'm about to replace missing values, I want to know what the source says they mean. If I'm about to calculate a new column, I want to know which inputs it uses and how I can check the result. I've always been a big fan of method chaining. With CLEANER, I have a way to decide what belongs in the chain.
What does that kind of process look like if you’re working with AI?
I use a process called RECL. It stands for Requirements, Execute, Check, and Loop. If I'm working on something important, I'll write down what I expect the result to do, give the agent a piece of work to execute, and check what it did. Then I can accept the work or ask for a specific correction before moving on. I'm still responsible for the analysis, and I want to understand it well enough to explain why the results are right.
In the course, I ask an agent to brainstorm and rank ways to test the distance calculation. One test uses two points one degree apart on the equator. We can work out the expected answer from the circumference of a sphere and use that value to check the implementation. The agent can help me come up with cases. I still want to be able to explain why a case belongs in the test suite and where its expected answer came from.
If Polars already runs in Rust, why would you write a Rust plugin?
If a calculation is slow, I first want to see how much of the wait comes from that calculation and whether I can express it with native Polars. In the book's Haversine benchmark on 10,000 coordinate pairs, the Python callback averaged 10.01 milliseconds. The native Polars expression averaged 0.541 milliseconds, and the Rust expression plugin averaged 0.187 milliseconds. If I have a slow operation that I can't express conveniently in Polars, then I'd consider writing a plugin and measuring the difference on the data I actually use.

The book’s extension chapter compares six ways to calculate Haversine distance.
I wanted the course to show the whole process. We use uv to set up the project, build the Rust extension, benchmark it alongside the other implementations, and package it as a wheel. Then we install the wheel and run the tests in a fresh project. If somebody else is going to use the plugin, that's the part I want to see work.