mercredi 29 novembre 2017

How to reassign a value from one column where two other columns have the same values

Initial dataframe After values have been re-assigned

The dataset is a pandas data frame from a combination of two different datasets. df1 has the columns (Area, Efficiency, Event_x, Phase, Time_e). df2 has the columns (Time, Velocity, X, Y). They're related but sampled at different time frequencies. I've changed the time, which was in 24hrtime to be in total seconds so it's easier to match up. Essentially, the problem I'm trying to solve is: how do I re-assign the values of the df1 columns when Time and Time_e are equal. The first row is fine 47439 == 47439. The time of the second instance is 47442 but its on the row of 47439. I need to move those values down to where time is 47442 and repeat the same process for subsequent rows.

To complicate matters further, sometimes there are multiple instances at the same interval of Time_e. I'm hoping to post those beneath each other.

Aucun commentaire:

Enregistrer un commentaire