Friday, June 2, 2023
HomeArtificial IntelligenceAnalyzing California’s Electrical Car Adoption Charge | by Dan Wilentz | Apr,...

Analyzing California’s Electrical Car Adoption Charge | 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 an enormous piece of that puzzle are the automobiles its residents use to go about their every day lives. At the side of the Inflation Discount Act (which supplies tax credit as much as $7,500 for brand 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 Superior Clear Automobiles II (ACC II) rules, which require automaker gross sales to be a minimum of 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 Car (EV) Adoption Charge by Californians within the period of those new incentives. I outline EV adoption charge as:

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

On this evaluation, we’ll discover whether or not California is on monitor to hit the 2026 goal of 35% EV Adoption Charge 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.

Necessary word: Because the 35% requirement is in the end on automobile gross sales and the DMV supplies us with automobile registration counts (not automobile gross sales counts), this evaluation approximates gross sales utilizing registrations. Particularly, for every year of DMV knowledge, I solely used vehicles made inside 3 years of the automobile registration date to approximate registrations as new vehicles being bought.

The information is publicly accessible on California’s Open Knowledge 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 at liberty to skip this part in the event you’re solely within the outcomes.

This undertaking served as a chance for me to learn to use GeoPandas, a python library used for knowledge evaluation initiatives with a spatial part.

The overall workflow for utilizing GeoPandas is to attach the info you wish to plot (corresponding to 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 toddler class of the Pandas DataFrame object and features a geometry column.

For me, I had automobile counts on the zip code stage, however I wished to plot automobile counts on a county stage. I began with the mandatory library imports and skim in my geojson recordsdata 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 “energetic” geometry column. Whichever column is energetic will likely be used for joins, plotting, or different functions. You should use the GeoDataFrame.set_geometry() methodology to set the geometry to a unique column. Additionally, when two GeoDataFrames are joined, one of many energetic geometry columns will likely be dropped (as a GeoDataFrame can solely have one energetic geometry column)

Since I wished to mix my zip code and county GeoDataFrames however protect the geometry data 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 decreased 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 energetic geometry:

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

# Set the zip code energetic 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 title, county title, zip code geometry, and county geometry, I joined automobile 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 title, county geography, automobile rely, and EV rely. Good 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 Charge 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 Charge (2022) by County’, dimension=18, weight=’daring’)

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

EV Adoption Charge (General):

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

We will discover a bump in gross sales from 2021 to 2022. This enhance 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 is not going to hit the objective of 35% EV adoption charge by 2026. Nonetheless, the DMV knowledge displays automobile counts in the beginning of every yr, and subsequently isn’t counting the time period 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 charge for the yr of 2022, and was taken from If we embody the blue circle within the development and extrapolate linearly, it seems to be just like the objective of 35% by 2026 is prone to be happy.

That being stated, assuming a linear extrapolation is an oversimplification and will not even be the right form of the development. General, it’s laborious to foretell what the subsequent 4 years will appear like, however the enhance from 2021 to 2022 is a promising signal, as is the additional knowledge level from

EV Adoption Charge (County Stage):

We will additionally take a look at EV adoption charge 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 biggest EV adoption charges of the state. In different elements of the state, EV adoption charge tends to be increased alongside coastal counties, and alongside the Bay Space — Tahoe hall. Particularly, the next 5 counties have the very 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 may use revenue knowledge from the most up-to-date 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 charge are typically 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 might have residents who really feel hesitant to undertake EVs as these areas are inclined to face extreme climate (and maybe there’s a sentiment amongst residents that EVs will likely be a purposeful downgrade from what they’re used to in these situations). Additionally it is potential that there’s little charging infrastructure on this a part of the state. The large outlier right here is Imperial County, the southeastern most county of California. It’s a extra populous county than the others on this listing and is a desert (versus redwood stuffed mountains). It might even be going through an infrastructure scarcity. Though out of scope for this evaluation, we may decide if lack of infrastructure correlates with EV adoption charge by EV charger location knowledge 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 is not going to.

Linear Extrapolation — primarily based on 2021 to 2022 countywide development

Nonetheless, this extrapolation doesn’t embody EV adoption charges after the brand new incentive construction. If we extrapolate by assuming yearly development is the same as the common 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 — primarily based on common of 2021 to 2022 countywide development and 2022–2023 statewide development

Equally to the EV adoption charge graph we noticed earlier, the counties with the upper EV adoption charges are typically 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 “essential” to deal with. These are the counties that may be regarded as having the very best space for enchancment/greatest alternative to push California as an entire in the direction of the 2026 objective. 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 charge in 2026, this area may have been an enormous purpose for that. Los Angeles is a very notable county right here. I’m projecting it to be at 33.7% EV adoption charge in 2026 (virtually hitting the objective of 35% however not fairly), however since it’s so excessive in inhabitants, it seems in the direction of the highest of the listing of most essential 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 method wherein we will take into consideration predicting future EV adoption. In future iterations of this work, we may embody extra complexity for probably extra correct outcomes.

EV Adoption Charge (Automaker Stage):

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

Necessary word: 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 undecided which EVs are on this group, but when they had been all accurately apportioned, these outcomes may look completely different.

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

2022 DMV Knowledge

We will 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 a number of proportion factors increased. From this knowledge, it’s clear that automakers have numerous work to do to get to 35% EV gross sales by 2026.

I mentioned this listing with a number of business professionals, who identified an odd lack of particular automakers, significantly Nissan, Kia, and Hyundai. I did some digging and noticed that Nissan particularly had registered many older EVs (corresponding to EVs made in 2018 or 2019) in 2022, and subsequently had been being filtered out by my rule of solely vehicles that had been made inside the previous 3 years of the registration yr. If I included one additional yr, Nissan was included on this listing at #8. Honda additionally made it onto the listing on this situation. This adjustment didn’t change the outcomes for Hyundai and Kia very a lot. It’s potential that these two automakers are vital parts of the “Different/Unknown” group talked about above.

If we as an alternative 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 massive automakers (excluding Tesla) have numerous work to do to be able 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 listing for the foreseeable future, the tax credit will primarily profit Chevrolet, Ford, Tesla, Jeep, and Lincoln and harm Nissan, Volvo, Audi, Hyundai, Kia, Subaru, Toyota, and Volkswagen (though I’ve seen conflicting data 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) corresponding to China.

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

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



Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments