Home Artificial Intelligence Analyzing California’s Electric Vehicle Adoption Rate Data Process Technical Approach (GeoPandas Tutorial) Results

Analyzing California’s Electric Vehicle Adoption Rate Data Process Technical Approach (GeoPandas Tutorial) Results

Analyzing California’s Electric Vehicle Adoption Rate
Technical Approach (GeoPandas Tutorial)

Using DMV Data with Pandas and GeoPandas

Tesla (Courtesy of Matt Weissinger on pexels.com)

California is pushing for aggressive societal change towards a net-zero emissions future, and an enormous piece of that puzzle are the vehicles its residents use to go about their every day lives. At the side of the Inflation Reduction Act (which provides tax credits as much as $7,500 for brand spanking new EV purchases and as much as $4,000 for used EVs — conditional on locations of car assembly and battery material sourcing), California has implemented the Advanced Clean Cars II (ACC II) regulations, which require automaker sales to be a minimum of 35% EVs by 2026. After 2026, the requirement scales up linearly annually until 2035, when all sales have to be EVs.

This evaluation focuses on the Electric Vehicle (EV) Adoption Rate by Californians within the era of those latest incentives. I define EV adoption rate as:

EV Adoption Rate = (total EVs purchased) / (total vehicles purchased)

On this evaluation, we’ll explore whether California is on target to hit the 2026 goal of 35% EV Adoption Rate using publicly available DMV registration data. Then we’ll break this down further to take a look at progress on a geographic level and an automaker level.

Necessary note: Because the 35% requirement is ultimately on vehicle sales and the DMV provides us with vehicle registration counts (not vehicle sales counts), this evaluation approximates sales using registrations. Specifically, for annually of DMV data, I only used cars made inside 3 years of the vehicle registration date to approximate registrations as latest cars being purchased.

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

Geography data:

  1. Ingest publicly available data and clean it using Pandas.
  2. Analyze data with Pandas. Overlay it onto maps and plot it with GeoPandas.
  3. Push code routinely to github.
  4. Iterate!

Be happy to skip this section if you happen to’re only serious about the outcomes.

This project served as a chance for me to learn how one can use GeoPandas, a python library used for data evaluation projects with a spatial component.

The final workflow for using GeoPandas is to attach the information you should plot (akin to variety of vehicles and EVs in a zipper code) with an associated geometry (akin to the zip codes geometrical boundaries) inside a structure called 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 vehicle counts on the zip code level, but I desired to plot vehicle counts on a county level. I began with the mandatory library imports and browse in my geojson files 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 probably be used for joins, plotting, or other applications. You need to use the GeoDataFrame.set_geometry() method to set the geometry to a unique column. Also, when two GeoDataFrames are joined, one in all the energetic geometry columns will probably be dropped (as a GeoDataFrame can only have one energetic geometry column)

Since I desired to mix my zip code and county GeoDataFrames but preserve the geometry information of each, I renamed the zip code geometry column. I also 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 multiple county boundaries, and I desired to assign a zipper code just once, I took the centroid (which is the geometric center of an object) of every zip code’s boundaries, after which looked to see if that zip code centroid lay inside a county’s boundaries. Effectively, I reduced each zip code’s overall shape to its center-point after which determined 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 effectively sets 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 those 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)

Finally, I joined the 2 GeoDataFrames:

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

Once I had a GeoDataFrame that included zip code name, county name, zip code geometry, and county geometry, I joined vehicle counts and EV counts by zip code onto my GeoDataFrame, and aggregated counts to the county level. This left me with a GeoDataFrame with 58 rows (for the 58 counties in California) which included county name, county geography, vehicle count, and EV count. Perfect for plotting!

Here is an example of the plotting code below. In it, I also included an additional GeoDataFrame for some cities in California to function landmarks on my plot:

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

color = ‘orange’,
markersize = 10)

for idx, row in city_gdf.iterrows():
plt.annotate(text=row[‘city’], xy=row[‘coords’], horizontalalignment=’center’, color=’Black’)


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

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

This code produced the primary map of California in the subsequent section (Results).

EV Adoption Rate (Overall):

Above is a graph demonstrating EV adoption rate across your complete state of California from 2018 through 2022. EVs are qualified as battery-electric vehicles, hydrogen fuel-cell vehicles, or plug-in hybrids. Nevertheless, EVs don’t include hybrid-gasoline cars (as those don’t satisfy the tax credit requirements or the automaker regulations). A 2019 Toyota Prius, for instance, wouldn’t count.

We will notice a bump in sales from 2021 to 2022. This increase was from about 6.6% to 9.5%. The rise seems 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 appears we won’t hit the goal of 35% EV adoption rate by 2026. Nevertheless, the DMV data reflects vehicle counts at first of annually, and due to this fact isn’t counting the time period after the brand new incentive structure was rolled out (August of 2022). The blue circle within the graph above compensates for that. It demonstrates the state-wide EV adoption rate for the 12 months of 2022, and was taken from energy.ca.gov. If we include the blue circle within the trend and extrapolate linearly, it looks just like the goal of 35% by 2026 is more likely to be satisfied.

That being said, assuming a linear extrapolation is an oversimplification and will not even be the proper shape of the trend. Overall, it’s hard to predict what the subsequent 4 years will appear like, but the rise from 2021 to 2022 is a promising sign, as is the additional data point from energy.ca.gov.

EV Adoption Rate (County Level):

We may also have a look at EV adoption rate on a county level, to get an idea of how spatially the state is trending towards purchasing EVs at higher rates:

Within the map above, we are able to see that the Bay Area by far has the biggest EV adoption rates of the state. In other parts of the state, EV adoption rate tends to be higher along coastal counties, and along the Bay Area — Tahoe corridor. Specifically, the next 5 counties have the best EV adoption rates:

One hypothesis for why the Bay Area has high EV adoption rates in comparison with the remainder of the state is that it reflects the wealth and political leanings of the residents who reside there (while out of scope for this evaluation, we could use income data from probably the most recent census and the way Californian’s voted on prop 30 in 2022 to explore this further)

The areas of California with the bottom EV adoption rate are inclined to be clustered within the northeast section of the state. The 5 counties with the bottom EV adoption rates are:

The northeast area of California is low in population. It could have residents who feel hesitant to adopt EVs as these areas are inclined to face severe weather (and maybe there’s a sentiment amongst residents that EVs will probably be a functional downgrade from what they’re used to in these conditions). It is usually possible that there’s little charging infrastructure on this a part of the state. The large outlier here is Imperial County, the southeastern most county of California. It’s a more populous county than the others on this list and is a desert (versus redwood filled mountains). It might also be facing an infrastructure shortage. Although out of scope for this evaluation, we could determine if lack of infrastructure correlates with EV adoption rate by taking a look at EV charger location data from the US Department of Energy.

If we take each county’s 2021 and 2022 EV adoption rates and extrapolate linearly, we are able to provide you with an estimate for which counties will hit the goal by 2026 and which is able to not.

Linear Extrapolation — based on 2021 to 2022 countywide growth

Nevertheless, this extrapolation doesn’t include EV adoption rates after the brand new incentive structure. If we extrapolate by assuming yearly growth is the same as the common of county-wide 2021 to 2022 growth and the statewide 2022 to 2023 growth as taken from energy.ca.gov, we are able to produce the projection below:

Linear Extrapolation — based on average of 2021 to 2022 countywide growth and 2022–2023 statewide growth

Similarly to the EV adoption rate graph we saw earlier, the counties with the upper EV adoption rates are inclined to be those I’m projecting will hit the 2026 goal. If we take all of the counties that are usually not projected to hit the goal, and take how much they’re projected to miss the goal, weighted by their respective populations, we are able to determine which counties are most “necessary” to give attention to. These are the counties that could be regarded as having the best area for improvement/biggest opportunity to push California as an entire towards the 2026 goal. The next 5 highest opportunity counties are as follows:

These counties mostly lie along the southeast corner of the state and within the southern central valley. They’re each high in population and low in EV usage. If California is lagging behind 35% EV adoption rate in 2026, this region might have been an enormous reason for that. Los Angeles is a very notable county here. I’m projecting it to be at 33.7% EV adoption rate in 2026 (almost hitting the goal of 35% but not quite), but because it is so high in population, it appears towards the highest of the list of most significant counties.

It is helpful to notice that the above model used to estimate EV adoption rates in 2026 could be very easy and is just a technique during which we are able to take into consideration predicting future EV adoption. In future iterations of this work, we could include more complexity for likely more accurate results.

EV Adoption Rate (Automaker Level):

We may also have a look at the information on an automaker level to evaluate which automakers are on their technique to hitting the 2026 goal and that are lagging.

Necessary note: I noticed that the DMV data had a big percentage (roughly 28%) of EVs labeled as “Other/Unknown” when it got here to their make. I’m undecided which EVs are on this group, but in the event that they were all accurately apportioned, these results could look different.

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

2022 DMV Data

We will see that Tesla has the lion’s share with Toyota a distant second. After that there’s an extended tail of other EV sellers. Most automakers’ EV rates are within the low single digits, with a few luxury brands at a number of percentage points higher. From this data, it’s clear that automakers have lots of work to do to get to 35% EV sales by 2026.

I discussed this list with a number of industry professionals, who identified an odd lack of specific automakers, particularly Nissan, Kia, and Hyundai. I did some digging and saw that Nissan particularly had registered many older EVs (akin to EVs made in 2018 or 2019) in 2022, and due to this fact were being filtered out by my rule of only taking a look at cars that were made throughout the past 3 years of the registration 12 months. If I included one extra 12 months, Nissan was included on this list at #8. Honda also made it onto the list on this scenario. This adjustment didn’t change the outcomes for Hyundai and Kia very much. It’s possible that those two automakers are significant portions of the “Other/Unknown” group mentioned above.

If we as an alternative order our data by who sells probably the most vehicles overall, we see the next:

2022 DMV Data

From this graph, it’s clear that each one large automakers (apart from Tesla) have lots of work to do in an effort to hit 35% EV sales.

IRS updates regarding which vehicles will qualify for the IRA tax credit were shared with the general public on 4/17/23. Assuming no changes to this list for the foreseeable future, the tax credits will primarily profit Chevrolet, Ford, Tesla, Jeep, and Lincoln and hurt Nissan, Volvo, Audi, Hyundai, Kia, Subaru, Toyota, and Volkswagen (although I’ve seen conflicting information of whether the Volkswagen ID.4 will qualify). This is predicted, because the IRA is purported to stimulate automotive manufacturing (and consequently automaker jobs) throughout the US and its allies, and is purported to decrease reliance on Foreign Entities of Concern (FEC) akin to China.

We may also examine California on a county level and see that are the highest EV sellers per county:

Tesla is by far the most important seller with Toyota the second biggest. After that, it’s not clear if any EV sellers have clear regions where they’re strong.


Please enter your comment!
Please enter your name here