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 an Azure Databricks database, containing a schema called vehicles and a single table named charging_sessions with the following columns:
vehicles.charging_sessions
| Column | Definition | Data type |
|---|---|---|
garage_id | Identifier for the garage/building | STRING |
user_id | Identifier for the individual user | STRING |
user_type | Indicating whether the station is Shared or Private | STRING |
start_plugin | The date and time the session started | TIMESTAMP |
start_plugin_hour | The hour (in military time) that the session started | NUMERIC |
end_plugout | The date and time the session ended | TIMESTAMP |
end_plugout_hour | The hour (in military time) that the session ended | NUMERIC |
duration_hours | The length of the session, in hours | NUMERIC |
el_kwh | Amount of electricity used (in Kilowatt hours) | NUMERIC |
month_plugin | The month that the session started | STRING |
weekdays_plugin | The day of the week that the session started | STRING |
Let’s get started!
Sources
-- unique_users_per_garage
-- Modify the code below
SELECT vehicles.charging_sessions.garage_id, Count(distinct vehicles.charging_sessions.user_id) as num_unique_users
FROM VEHICLES.CHARGING_SESSIONS
where user_type = 'Shared'
group by 1
order by 2 desc;-- most_popular_shared_start_times
Select weekdays_plugin, start_plugin_hour, count(*) as num_charging_sessions
from vehicles.charging_sessions
where user_type = 'Shared'
group by 1, 2
order by 3 desc
limit 10;-- long_duration_shared_users
SELECT DISTINCT user_id, AVG(VEHICLES.CHARGING_SESSIONS.duration_hours) as avg_charging_duration
FROM VEHICLES.CHARGING_SESSIONS
where user_type = 'Shared'
group by 1
having AVG(VEHICLES.CHARGING_SESSIONS.duration_hours) > 10
order by 2 desc
-- limit 10;