Python Forum
Grouping and summing of dataset
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grouping and summing of dataset
#1
I have this dataset that I imported with pandas:

Output:
Date Hour Water 2020-01-01 2 5 2020-01-01 3 45 2020-01-01 4 63 2020-01-01 7 0 2020-01-01 24 35 2020-01-02 1 25
I want to total individual instances of the number of hours and liters. Each "hour" represents an hourly interval on my measuring device. Each "water" is the number of liters of water that flowed through the device in that hour. Thus the desired output is:

Output:
Start date Start hour Hours Elapsed Water 2020-01-01 2 3 113 2020-01-01 24 2 60
If there are missing rows of dates/hours or if there is a row where water=BLANK or water=0, we should skip those.

Whats the easiest way to add this up?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Grouping Data based on 30% bracket purnima1 4 1,141 Mar-10-2023, 07:38 PM
Last Post: deanhystad
  Summing up set elements(HH:MM:SS) tester_V 4 1,102 Dec-22-2022, 10:03 AM
Last Post: perfringo
  Grouping and sum of a list of objects Otbredbaron 1 3,129 Oct-23-2021, 01:42 PM
Last Post: Gribouillis
  Summing up rows and columns plumberpy 3 2,219 Aug-18-2021, 05:46 AM
Last Post: naughtyCat
  Summing a list of numbers Oldman45 6 2,781 Jul-12-2020, 05:30 PM
Last Post: Oldman45
  Merge 2 dataframes but avoid double summing of rows? vinaysalian17 0 1,817 Jun-03-2020, 01:48 AM
Last Post: vinaysalian17
  Grouping algorithm riccardoob 7 2,926 May-19-2020, 01:22 PM
Last Post: deanhystad
  Help Grouping by Intervals on list paul41 1 2,071 Dec-03-2019, 09:43 PM
Last Post: michael1789
  Grouping a list of various time into intervals paul41 1 3,729 Nov-24-2019, 01:47 PM
Last Post: buran
  resample grouping pr0blem olufemig 1 1,924 Nov-06-2019, 10:45 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020