I have the following dataframe for which I want to detect if the results are inconsistent:
>>> import pandas as pd
>>> import numpy as np
>>> df = pd.DataFrame(np.array([[1, 2, 3, 1], [4, 5, 6, 0], [7, 8, 9, 0], [4, 5, 6, 1], [1, 2, 3, 1]]),
... columns=['a', 'b', 'c', 'result'])
>>> df
a b c result
0 1 2 3 1
1 4 5 6 0
2 7 8 9 0
3 4 5 6 1
4 1 2 3 1
My goal is to drop those rows that show different results for the same values (id 1 and 3 should be dropped). I know I can detect duplicates and loop over the results
>>> df[df.duplicated(['a', 'b', 'c'], keep=False)]
a b c result
0 1 2 3 1
1 4 5 6 0
3 4 5 6 1
4 1 2 3 1
But I was wondering if there's a more pythonic way of getting (and dropping) those indexes.