Skip to content
3 min read · Tags: plotting seaborn excel window-functions multi-index

BW #126: EV sales

Get better at: Working with Excel files, plotting with Seaborn, mult-indexes, and window functions

BW #126: EV sales

When I travel to the United States, I'm often struck by how few electric vehicles (EVs) I see – and most of those I do see are Teslas. In Europe and Israel, by contrast, you see EVs everywhere, with models from a dozen or more manufacturers.

Part of the reason for the growth in EVs is that they're just great cars. (We've had one since January of last year, and I continue to be amazed by how great it is.) It also costs significantly less to charge a car than to fill it with gasoline. Moreover, EVs require less maintenance than gas-powered cars, in part because they have many fewer parts.

What about charging? We almost always charge our EV at home, but if we need to do so while on the road, nearly every gas station has at least one car charger. Many supermarket and mall parking lots have electric-charging spots, allowing you to charge while buying groceries or getting something to eat.

Another reason for the growth in EV sales has been the rebates and tax credits that many governments offer. The US has offered such credits for about two decades, but that will end on September 30th, now that President Donald Trump's budget has come into law (https://www.marketplace.org/story/2025/07/08/ev-tax-credits-will-end-september-30-after-nearly-20-years).

This led me to wonder: How many EVs have really been sold over the last few years? Has the US seen an uptick in the number of EVs sold? Where are these EVs being sold?

The good news? We can answer at least some of these questions using government data.

Data and six questions

This week's data comes from the US Department of Transportation's Bureau of Transportation Statistics. Their site, at https://www.bts.gov/browse-statistical-products-and-data/state-transportation-statistics/electric-vehicle-registrations , shows EV registrations, other vehicle registrations, and EVs' electrical consumption. It includes data for the entire United States, and then per-state data, as well.

Sadly, data from 2024 only includes the total EV consumption, and not vehicle registrations. We'll thus have to make do with registration data from 2023 and earlier.

You can download the data file by clicking on the download button at the bottom of the displayed table; it looks like a rectangle with an arrow pointing down, and will show, "Choose a format to download" in the tooltip when you hover over it. Click on the icon, and choose "crosstab" as the data format you want, then choose "Excel." This will download an Excel document ("Sheet 1.xlsx") onto your computer.

Paid subscribers, including members of my LernerPython+data platform, can download the data file from the end of this message.

This week's learning goals include: Working with Excel files, multi-indexes, window functions, and plotting with Seaborn.

I'll be back tomorrow with my solutions, including (for paid subscribers) my Jupyter notebook and a one-click link to open the notebook in Google Colab.

Meanwhile, here are my six questions: