0

I have data available as

                                EndTime  Duration  PartsProduced
StartTime                                                       
2020-09-03 00:14:51 2020-09-03 00:46:56      1925         9100.0
2020-09-03 00:53:09 2020-09-03 01:16:43      1414         6500.0
2020-09-03 01:18:45 2020-09-03 01:36:58      1093         4900.0
2020-09-03 01:38:56 2020-09-03 01:53:46       890         3700.0
2020-09-03 02:11:56 2020-09-03 02:15:41       225          500.0
2020-09-03 02:19:04 2020-09-03 02:39:47      1243         5600.0
2020-09-03 02:39:49 2020-09-03 03:10:12      1823         8100.0
2020-09-03 03:48:37 2020-09-03 03:59:59       682         3300.0
2020-09-03 04:00:00 2020-09-03 04:12:09       729         3100.0
2020-09-03 04:20:35 2020-09-03 04:23:12       157          300.0
2020-09-03 04:23:46 2020-09-03 04:32:32       526         1700.0
2020-09-03 04:35:54 2020-09-03 04:41:21       327         1000.0
2020-09-03 04:46:10 2020-09-03 05:11:58      1548         6900.0
2020-09-03 05:16:22 2020-09-03 05:30:56       874         3600.0
2020-09-03 05:44:24 2020-09-03 05:52:18       474         1500.0
2020-09-03 05:53:45 2020-09-03 05:58:31       286          900.0
2020-09-03 06:03:28 2020-09-03 06:05:22       114          100.0
2020-09-03 06:07:18 2020-09-03 06:10:12       174          500.0
2020-09-03 06:18:48 2020-09-03 06:21:50       182          100.0

I want to have a split/resampling happening on field StartTime in hourly manner, which splits both Duration and PartProduced in Ratios

      Hourly_DateTime  Duration  PartsProduced
0 2020-09-02 23:00:00       699         2700.0
1 2020-09-03 00:00:00      3339        15600.0
2 2020-09-03 01:00:00      1983         8600.0
3 2020-09-03 02:00:00      3291        14200.0
4 2020-09-03 03:00:00       682         3300.0
5 2020-09-03 04:00:00      3287        13000.0
6 2020-09-03 05:00:00      1634         6000.0
7 2020-09-03 06:00:00       470          700.0

How can I achieve this?

I have tried to get the details using resample from Pandas.

g.set_index('StartTime', inplace=True)
k = g.resample('H').sum()
s_mj
  • 530
  • 11
  • 28
  • Please edit to include your sample input as text, not picture. You can copy a snippet of the dataframe to the clipboard using `df.head().to_clipboard(False)`. Then paste it in your question – Code Different Nov 11 '20 at 14:18
  • @CodeDifferent done – s_mj Nov 11 '20 at 14:51

0 Answers0