filtering a pandas dataframe without removing rows,df.where((df > df.shift(1)).values & DataFrame(df.D == 1).values)