Home > Software design >  Trying to condense data in several columns across multiple rows based on a common column value - pyt
Trying to condense data in several columns across multiple rows based on a common column value - pyt

Time:02-02

I've got some data I'm trying to reorganize in my pandas dataframe. Here is a snippet PNG:

enter image description here

So for each Date_Time reading there are 7 rows. What I want to do is condense those 7 rows down into one. And I want to sum all the important data columns (Voltage, Current, ChargeCapacity, DischargeCapacity, ChargeEnergy, DischargeEnergy, and dV/dt(V/s). Thank you!

CodePudding user response:

How about this ?

df.groupby("Date_Time")[["Voltage", "Current", "ChargeCapacity", "DischargeCapacity", "ChargeEnergy", "DischargeEnergy", "and dV/dt(V/s)"]].sum()
  •  Tags:  
  • Related