df = pd.DataFrame({'val1': [1, 1, 2, 2, 1, 1], 'val2': [2, 2, 3, 3, 3, 2]})
df.loc[(df.val1.shift(1) != df.val1) | (df.val2.shift(1) != df.val2)]
How to index a pandas dataframe using locations wherever the data changes