ComenzarEmpieza gratis

Are charging durations getting longer?

The Data Science team currently has a model that predicts the number of open chargers based on average vehicle charging duration. This allows for them to send notifications to previous users when it might be a good time to charge. However, the team believes that average charging duration may have changed since the last time they trained their model. Can you validate this for them?

Este ejercicio forma parte del curso

Window Functions in Snowflake

Ver curso

Instrucciones del ejercicio

  • Use a window function to find the running average of vehicle charging_duration.
  • Partition the results by charging_station_location.
  • Sequence the window by charging_start_time in ascending order.
  • Create the window of records to always be between the first row and the CURRENT ROW.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

SELECT
	user_id,
    charging_station_location,
	TO_DATE(charging_start_time),
    charging_duration,

    -- Find the running average of charging duration
    ___ OVER(
      	-- Partition the results by charging_station_location
      	___

        -- Sequence the results by charging start time in ascending order
        ORDER BY ___

        -- Create the window of records to always be between the 
      	-- first row and the current row
        ___

    ) AS running_average
FROM ELECTRIC_VEHICLES.charging;
Editar y ejecutar código