[Python] Raw data break down

Discussão em 'Python' iniciado por Stack, Agosto 4, 2025.

  1. Stack

    Stack Membro Participativo

    can I please be assisted on how I can get this data broken down into hourly figures on sql from cumulative figure:

    This is the raw data from SQL table:


    CalendarDate Sequence TimeStamp DateTimeStamp DMS1
    2025/08/01 24 05:59:00 2025-08-01 05:59:00 2313
    2025/08/01 23 05:00:00 2025-08-01 05:00:00 2188
    2025/08/01 22 04:00:00 2025-08-01 04:00:00 2062
    2025/08/01 21 03:00:00 2025-08-01 03:00:00 1937
    2025/08/01 20 02:00:00 2025-08-01 02:00:00 1812
    2025/08/01 19 01:00:00 2025-08-01 01:00:00 1687
    2025/07/31 18 23:59:00 2025-07-31 23:59:00 1942
    2025/07/31 17 23:00:00 2025-07-31 23:00:00 1825
    2025/07/31 16 22:00:00 2025-07-31 22:00:00 1708
    2025/07/31 15 21:00:00 2025-07-31 21:00:00 1592
    2025/07/31 14 20:00:00 2025-07-31 20:00:00 1474
    2025/07/31 13 19:00:00 2025-07-31 19:00:00 1386
    2025/07/31 12 18:00:00 2025-07-31 18:00:00 1269
    2025/07/31 11 17:00:00 2025-07-31 17:00:00 1154
    2025/07/31 10 16:00:00 2025-07-31 16:00:00 1050
    2025/07/31 9 15:00:00 2025-07-31 15:00:00 950
    2025/07/31 8 14:00:00 2025-07-31 14:00:00 850
    2025/07/31 7 13:00:00 2025-07-31 13:00:00 732
    2025/07/31 6 12:00:00 2025-07-31 12:00:00 621
    2025/07/31 5 11:00:00 2025-07-31 11:00:00 508
    2025/07/31 4 10:00:00 2025-07-31 10:00:00 401
    2025/07/31 3 09:00:00 2025-07-31 09:00:00 280
    2025/07/31 2 08:00:00 2025-07-31 08:00:00 180
    2025/07/31 1 07:00:00 2025-07-31 07:00:00 105


    I have tried writing an SQL query for rolling sum (quer below) but isn't giving me the result I want.

    SELECT [CalendarDate]
    ,[Sequence]
    ,[TimeStamp]
    ,[DateTimeStamp]
    ,[DMS1],
    sum(DMS1) over (order by DateTimeStamp,Sequence )
    FROM [DB].[dbo].[vPlantData]

    Continue reading...

Compartilhe esta Página