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
  Summing up set elements(HH:MM:SS) tester_V 4 2,545 Dec-22-2022, 10:03 AM
Last Post: perfringo
  Grouping and sum of a list of objects Otbredbaron 1 5,232 Oct-23-2021, 01:42 PM
Last Post: Gribouillis
  Summing up rows and columns plumberpy 3 3,022 Aug-18-2021, 05:46 AM
Last Post: naughtyCat
  Summing a list of numbers Oldman45 6 4,049 Jul-12-2020, 05:30 PM
Last Post: Oldman45
  Merge 2 dataframes but avoid double summing of rows? vinaysalian17 0 2,397 Jun-03-2020, 01:48 AM
Last Post: vinaysalian17
  Grouping algorithm riccardoob 7 4,466 May-19-2020, 01:22 PM
Last Post: deanhystad
  Help Grouping by Intervals on list paul41 1 3,355 Dec-03-2019, 09:43 PM
Last Post: michael1789
  resample grouping pr0blem olufemig 1 2,624 Nov-06-2019, 10:45 PM
Last Post: Larz60+
  Splitting lines ang grouping three at once samsonite 5 3,615 Jun-21-2019, 05:19 PM
Last Post: ichabod801
  filtering and summing data in a text file apexman 3 4,509 Mar-18-2019, 09:25 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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