I have a DataFrame consisting of charging sessions of electric vehicles with the following scheme and content:
PlugInTime, PlugOutTime, DeliveredEnergy, ChargeDuration
- 2019-01-02 05:53:00, 2019-01-02 14:38:00, 36.0, 05:57:00
- 2019-01-02 07:53:00, 2019-01-02 16:38:00, 8.0, 03:12:00
- ...
I want to split the individual rows based on the column ChargeDuration so that for example row one is being "exploded" to:
- 2019-01-02 05:53:00, 2019-01-02 14:38:00, 6.05, 05:57:00
- 2019-01-02 06:53:00, 2019-01-02 14:38:00, 6.05, 05:57:00
- 2019-01-02 07:53:00, 2019-01-02 14:38:00, 6.05, 05:57:00
- 2019-01-02 08:53:00, 2019-01-02 14:38:00, 6.05, 05:57:00
- 2019-01-02 09:53:00, 2019-01-02 14:38:00, 6.05, 05:57:00
- 2019-01-02 10:53:00, 2019-01-02 14:38:00, 5.75, 05:57:00
As you can see, I want ChargeDuration to determine into how many chunks PlugInTime is being split up and I want the DeliveredEnergy to be split accordingly with linear interpolation, so that the sum equals the original value.
After I have that, I want to resample the DataFrame hourly to so that I can determine the hourly energy demand across all the recorded charging sessions.
In my research prior to this post I came across many threads about resampling in pandas, but they are missing this split up step based on another column (here ChargeDuration).
Any help is highly appreciated.