Skip to content

As electronic vehicles (EVs) become more popular, there is an increasing need for access to charging stations, also known as ports. To that end, many modern apartment buildings have begun retrofitting their parking garages to include shared charging stations. A charging station is shared if it is accessible by anyone in the building.

But with increasing demand comes competition for these ports — nothing is more frustrating than coming home to find no charging stations available! In this project, you will use a dataset to help apartment building managers better understand their tenants’ EV charging habits.

The data has been loaded into a PostgreSQL database with a table named charging_sessions with the following columns:

charging_sessions

ColumnDefinitionData type
garage_idIdentifier for the garage/buildingVARCHAR
user_idIdentifier for the individual userVARCHAR
user_typeIndicating whether the station is Shared or PrivateVARCHAR
start_pluginThe date and time the session startedDATETIME
start_plugin_hourThe hour (in military time) that the session startedNUMERIC
end_plugoutThe date and time the session endedDATETIME
end_plugout_hourThe hour (in military time) that the session endedNUMERIC
duration_hoursThe length of the session, in hoursNUMERIC
el_kwhAmount of electricity used (in Kilowatt hours)NUMERIC
month_pluginThe month that the session startedVARCHAR
weekdays_pluginThe day of the week that the session startedVARCHAR

Let’s get started!

Sources
  • Data: CC BY 4.0, via Kaggle,
  • Image: Julian Herzog, CC BY 4.0, via Wikimedia Commons
Spinner
DataFrameas
df
variable
SELECT *
FROM charging_sessions;
Spinner
DataFrameas
unique_users_per_garage
variable
-- unique_users_per_garage
SELECT garage_id, COUNT(DISTINCT user_id) AS num_unique_users
FROM charging_sessions
WHERE user_type = 'Shared'
GROUP BY garage_id
ORDER BY num_unique_users DESC;
Spinner
DataFrameas
most_popular_shared_start_times
variable
-- most_popular_shared_start_times
SELECT weekdays_plugin, start_plugin_hour, COUNT(*) AS num_charging_sessions
FROM charging_sessions
WHERE user_type = 'Shared'
GROUP BY weekdays_plugin, start_plugin_hour
ORDER BY num_charging_sessions DESC
LIMIT 10;
  • The most popular start time by weekday and start hour is Sunday at 5pm with 30 charging sessions
  • The second most popular time by weekday is Friday at 3pm with 28 charging sessions.
  • Thursdays are interesting. One popular time is 7pm and another is 4pm in which each gets 26 charging stations.
  • It makes sense how the most popular weekdays happen to be those closer to the weekend since that's when people run errands. partake in activities, or charge their vehicles for their work commute - which also explains why Mondays and Tuesdays are low in the top 10.
Spinner
DataFrameas
long_duration_shared_users
variable
-- long_duration_shared_users
SELECT user_id, AVG(duration_hours) AS avg_charging_duration
FROM charging_sessions
WHERE user_type = 'Shared'
GROUP BY user_id
HAVING AVG(duration_hours) > 10
ORDER BY avg_charging_duration DESC;
  • 6 users charge their EVs for longer than 10 hours on average across all garages. This can be troublesome specifically for the garages where there are multiple EV vehicle owners because when all the charging stations are taken, they'd have to wait for hours, if not days for another one to become available.
  • Even though 6 users seems like a relatively low number, having to wait even an hour to charge a vehicle means that the vehicle probably cannot be used.
  • In this particular scenario, building managers should add more shared charging stations to eliminate this issue and make their building more attractive to qualified renters. Especially garages Bl2, AsO2, and UT9.