Skip to content Skip to sidebar Skip to footer

How To Drop_duplicates

I have raw data as following example. At instant t1, a variable has a value x1, this variable should be recorded at instant t2 if and only if its value is not equal to x1. There is

Solution 1:

df.drop_duplicates(subset=['Variable','Value'],keep='first')
#                time Variable  Value
#2014-07-11  19:50:20     Var1     10
#2014-07-11  19:50:30     Var1     20
#2014-07-11  19:50:50     Var2     30
#2014-07-11  19:50:60     Var2     40
#2014-07-11  19:50:70     Var2     50

Post a Comment for "How To Drop_duplicates"