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 a list of numbers Oldman45 6 696 Jul-12-2020, 05:30 PM
Last Post: Oldman45
  Merge 2 dataframes but avoid double summing of rows? vinaysalian17 0 474 Jun-03-2020, 01:48 AM
Last Post: vinaysalian17
  Grouping algorithm riccardoob 7 849 May-19-2020, 01:22 PM
Last Post: deanhystad
  Help Grouping by Intervals on list paul41 1 620 Dec-03-2019, 09:43 PM
Last Post: michael1789
  Grouping a list of various time into intervals paul41 1 1,140 Nov-24-2019, 01:47 PM
Last Post: buran
  resample grouping pr0blem olufemig 1 614 Nov-06-2019, 10:45 PM
Last Post: Larz60+
  Splitting lines ang grouping three at once samsonite 5 918 Jun-21-2019, 05:19 PM
Last Post: ichabod801
  filtering and summing data in a text file apexman 3 1,045 Mar-18-2019, 09:25 PM
Last Post: ichabod801
  Grouping csv by name terrydidi 8 1,369 Jan-14-2019, 09:27 AM
Last Post: perfringo
  Function for grouping variables Scott 1 1,216 Nov-13-2018, 03:01 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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