Analyzing California’s Electrical Automobile Adoption Price | by Dan Wilentz | Apr, 2023

Utilizing DMV Knowledge with Pandas and GeoPandas

Tesla (Courtesy of Matt Weissinger on

California is pushing for aggressive societal change in the direction of a net-zero emissions future, and a giant piece of that puzzle are the automobiles its residents use to go about their day by day lives. Along side the Inflation Reduction Act (which gives tax credit as much as $7,500 for brand spanking new EV purchases and as much as $4,000 for used EVs — conditional on places of car meeting and battery materials sourcing), California has carried out the Advanced Clean Cars II (ACC II) regulations, which require automaker gross sales to be at the very least 35% EVs by 2026. After 2026, the requirement scales up linearly every year till 2035, when all gross sales should be EVs.

This evaluation focuses on the Electrical Automobile (EV) Adoption Price by Californians within the period of those new incentives. I outline EV adoption fee as:

EV Adoption Price = (complete EVs bought) / (complete automobiles bought)

On this evaluation, we’ll discover whether or not California is on observe to hit the 2026 goal of 35% EV Adoption Price utilizing publicly accessible DMV registration knowledge. Then we’ll break this down additional to take a look at progress on a geographic stage and an automaker stage.

Essential notice: Because the 35% requirement is finally on car gross sales and the DMV gives us with car registration counts (not car gross sales counts), this evaluation approximates gross sales utilizing registrations. Particularly, for every year of DMV knowledge, I solely used automobiles made inside 3 years of the car registration date to approximate registrations as new automobiles being bought.

The info is publicly accessible on California’s Open Data Portal and California’s State Geoportal.

Geography knowledge:

  1. Ingest publicly accessible knowledge and clear it utilizing Pandas.
  2. Analyze knowledge with Pandas. Overlay it onto maps and plot it with GeoPandas.
  3. Push code routinely to github.
  4. Iterate!

Be happy to skip this part if you happen to’re solely within the outcomes.

This mission served as a chance for me to discover ways to use GeoPandas, a python library used for knowledge evaluation tasks with a spatial part.

The final workflow for utilizing GeoPandas is to attach the info you wish to plot (reminiscent of variety of automobiles and EVs in a zipper code) with an related geometry (such because the zip codes geometrical boundaries) inside a construction referred to as a GeoDataFrame. The GeoDataFrame is the bread and butter of GeoPandas and is a baby class of the Pandas DataFrame object and features a geometry column.

For me, I had car counts on the zip code stage, however I wished to plot car counts on a county stage. I began with the required library imports and browse in my geojson information for zip code and county boundaries.

import geopandas as gpd
import matplotlib.pyplot as plt

zip_codes = gpd.read_file(zip_code_geojson_path)
counties = gpd.read_file(county_geojson_path)

GeoDataFrames can have just one “lively” geometry column. Whichever column is lively shall be used for joins, plotting, or different functions. You should use the GeoDataFrame.set_geometry() methodology to set the geometry to a special column. Additionally, when two GeoDataFrames are joined, one of many lively geometry columns shall be dropped (as a GeoDataFrame can solely have one lively geometry column)

Since I wished to mix my zip code and county GeoDataFrames however protect the geometry info of each, I renamed the zip code geometry column. I additionally made a replica of the counties geometry column.

# rename zip_code geom column
zip_codes.rename_geometry(‘zip_code_geometry’, inplace=True)

# create duplicate county geometry column
counties[‘county_geometry’] = counties.geometry

Since some zip codes had boundaries which overlapped a number of county boundaries, and I wished to assign a zipper code solely as soon as, I took the centroid (which is the geometric middle of an object) of every zip code’s boundaries, after which regarded to see if that zip code centroid lay inside a county’s boundaries. Successfully, I lowered every zip code’s general form to its center-point after which decided which county a given zip code’s center-point was inside.

To do that, I first set the CRS (coordinate reference system) for every GeoDataFrame from 4326 (the default) to 3857. This successfully units our coordinate system from a globe to a map:

zip_codes.to_crs(3857, inplace = True)
counties.to_crs(3857, inplace = True)

I then calculated the zip code centroids and set these centroids to the lively geometry:

# Calculate zip code centroids
zip_codes[‘zip_code_centroid’] = zip_codes.centroid

# Set the zip code lively geometry to the centroid column
zip_codes.set_geometry(‘zip_code_centroid’, inplace=True)

Lastly, I joined the 2 GeoDataFrames:

zip_codes_with_county=gpd.sjoin(zip_codes, counties, how=’internal’,predicate=’intersects’)

As soon as I had a GeoDataFrame that included zip code identify, county identify, zip code geometry, and county geometry, I joined car counts and EV counts by zip code onto my GeoDataFrame, and aggregated counts to the county stage. This left me with a GeoDataFrame with 58 rows (for the 58 counties in California) which included county identify, county geography, car depend, and EV depend. Excellent for plotting!

Right here is an instance of the plotting code under. In it, I additionally included an additional GeoDataFrame for some cities in California to function landmarks on my plot:

# EV Adoption Price 2022
fig, ax = plt.subplots(figsize = (10, 10))
cmap = ‘Greens’)

coloration = ‘orange’,
markersize = 10)

for idx, row in city_gdf.iterrows():
plt.annotate(textual content=row[‘city’], xy=row[‘coords’], horizontalalignment=’middle’, coloration=’Black’)


for edge in [‘right’, ‘bottom’, ‘top’,’left’]:

ax.set_title(‘CA EV Adoption Price (2022) by County’, dimension=18, weight=’daring’)

This code produced the primary map of California within the subsequent part (Outcomes).

EV Adoption Price (Total):

Above is a graph demonstrating EV adoption fee throughout your complete state of California from 2018 by way of 2022. EVs are certified as battery-electric automobiles, hydrogen fuel-cell automobiles, or plug-in hybrids. Nevertheless, EVs don’t embrace hybrid-gasoline automobiles (as these don’t fulfill the tax credit score necessities or the automaker rules). A 2019 Toyota Prius, for instance, wouldn’t depend.

We are able to discover a bump in gross sales from 2021 to 2022. This improve was from about 6.6% to 9.5%. The rise appears to have come primarily from a rise in ZEV purchases.

If we assume a naive linear extrapolation from 2021 to 2022 to proceed onwards, then it seems we won’t hit the purpose of 35% EV adoption fee by 2026. Nevertheless, the DMV knowledge displays car counts at the start of every 12 months, and due to this fact isn’t counting the time frame after the brand new incentive construction was rolled out (August of 2022). The blue circle within the graph above compensates for that. It demonstrates the state-wide EV adoption fee for the 12 months of 2022, and was taken from If we embrace the blue circle within the development and extrapolate linearly, it seems just like the purpose of 35% by 2026 is more likely to be glad.

That being mentioned, assuming a linear extrapolation is an oversimplification and will not even be the proper form of the development. Total, it’s exhausting to foretell what the following 4 years will seem like, however the improve from 2021 to 2022 is a promising signal, as is the additional knowledge level from

EV Adoption Price (County Stage):

We are able to additionally take a look at EV adoption fee on a county stage, to get an concept of how spatially the state is trending in the direction of buying EVs at increased charges:

Within the map above, we will see that the Bay Space by far has the most important EV adoption charges of the state. In different components of the state, EV adoption fee tends to be increased alongside coastal counties, and alongside the Bay Space — Tahoe hall. Particularly, the next 5 counties have the best EV adoption charges:

One speculation for why the Bay Space has excessive EV adoption charges in comparison with the remainder of the state is that it displays the wealth and political leanings of the residents who reside there (whereas out of scope for this evaluation, we might use earnings knowledge from the most recent census and the way Californian’s voted on prop 30 in 2022 to discover this additional)

The areas of California with the bottom EV adoption fee are usually clustered within the northeast part of the state. The 5 counties with the bottom EV adoption charges are:

The northeast space of California is low in inhabitants. It could have residents who really feel hesitant to undertake EVs as these areas are likely to face extreme climate (and maybe there’s a sentiment amongst residents that EVs shall be a practical downgrade from what they’re used to in these circumstances). Additionally it is potential that there’s little charging infrastructure on this a part of the state. The massive outlier right here is Imperial County, the southeastern most county of California. It’s a extra populous county than the others on this record and is a desert (versus redwood stuffed mountains). It could even be going through an infrastructure scarcity. Though out of scope for this evaluation, we might decide if lack of infrastructure correlates with EV adoption fee by EV charger location data from the US Division of Vitality.

If we take every county’s 2021 and 2022 EV adoption charges and extrapolate linearly, we will provide you with an estimate for which counties will hit the goal by 2026 and which won’t.

Linear Extrapolation — based mostly on 2021 to 2022 countywide development

Nevertheless, this extrapolation doesn’t embrace EV adoption charges after the brand new incentive construction. If we extrapolate by assuming yearly development is the same as the typical of county-wide 2021 to 2022 development and the statewide 2022 to 2023 development as taken from, we will produce the projection under:

Linear Extrapolation — based mostly on common of 2021 to 2022 countywide development and 2022–2023 statewide development

Equally to the EV adoption fee graph we noticed earlier, the counties with the upper EV adoption charges are usually those I’m projecting will hit the 2026 goal. If we take all of the counties that aren’t projected to hit the goal, and take how a lot they’re projected to overlook the goal, weighted by their respective populations, we will decide which counties are most “necessary” to deal with. These are the counties that may be regarded as having the best space for enchancment/largest alternative to push California as a complete in the direction of the 2026 purpose. The next 5 highest alternative counties are as follows:

These counties largely lie alongside the southeast nook of the state and within the southern central valley. They’re each excessive in inhabitants and low in EV utilization. If California is lagging behind 35% EV adoption fee in 2026, this area might have been a giant cause for that. Los Angeles is a very notable county right here. I’m projecting it to be at 33.7% EV adoption fee in 2026 (virtually hitting the purpose of 35% however not fairly), however since it’s so excessive in inhabitants, it seems in the direction of the highest of the record of most necessary counties.

It’s helpful to notice that the above mannequin used to estimate EV adoption charges in 2026 could be very easy and is only one manner by which we will take into consideration predicting future EV adoption. In future iterations of this work, we might embrace extra complexity for probably extra correct outcomes.

EV Adoption Price (Automaker Stage):

We are able to additionally take a look at the info on an automaker stage to evaluate which automakers are on their option to hitting the 2026 goal and that are lagging.

Essential notice: I observed that the DMV knowledge had a big proportion (roughly 28%) of EVs labeled as “Different/Unknown” when it got here to their make. I’m unsure which EVs are on this group, but when they had been all appropriately apportioned, these outcomes might look totally different.

If we glance purely at who’s registering probably the most EVs, we see the next:

2022 DMV Knowledge

We are able to see that Tesla has the lion’s share with Toyota a distant second. After that there’s a lengthy tail of different EV sellers. Most automakers’ EV charges are within the low single digits, with a few luxurious manufacturers at just a few proportion factors increased. From this knowledge, it’s clear that automakers have lots of work to do to get to 35% EV gross sales by 2026.

I mentioned this record with just a few business professionals, who identified an odd lack of particular automakers, notably Nissan, Kia, and Hyundai. I did some digging and noticed that Nissan specifically had registered many older EVs (reminiscent of EVs made in 2018 or 2019) in 2022, and due to this fact had been being filtered out by my rule of solely automobiles that had been made inside the previous 3 years of the registration 12 months. If I included one further 12 months, Nissan was included on this record at #8. Honda additionally made it onto the record on this state of affairs. This adjustment didn’t change the outcomes for Hyundai and Kia very a lot. It’s potential that these two automakers are important parts of the “Different/Unknown” group talked about above.

If we as a substitute order our knowledge by who sells probably the most automobiles general, we see the next:

2022 DMV Knowledge

From this graph, it’s clear that each one giant automakers (aside from Tesla) have lots of work to do so as to hit 35% EV gross sales.

IRS updates concerning which automobiles will qualify for the IRA tax credit score had been shared with the general public on 4/17/23. Assuming no adjustments to this record for the foreseeable future, the tax credit will primarily profit Chevrolet, Ford, Tesla, Jeep, and Lincoln and damage Nissan, Volvo, Audi, Hyundai, Kia, Subaru, Toyota, and Volkswagen (though I’ve seen conflicting info of whether or not the Volkswagen ID.4 will qualify). That is anticipated, because the IRA is meant to stimulate automobile manufacturing (and consequently automaker jobs) inside the US and its allies, and is meant to lower reliance on Overseas Entities of Concern (FEC) reminiscent of China.

We are able to additionally look at California on a county stage and see that are the highest EV sellers per county:

Tesla is by far the most important vendor with Toyota the second largest. After that, it’s not clear if any EV sellers have clear areas the place they’re sturdy.

Leave a Reply

Your email address will not be published. Required fields are marked *