I have timestamp and id variables in my dataframe (df)
timestamp id
2016-06-09 8:33:37 a1
2016-06-09 8:33:37 a1
2016-06-09 8:33:38 a1
2016-06-09 8:33:39 a1
2016-06-09 8:33:39 a1
2016-06-09 8:33:37 b1
2016-06-09 8:33:38 b1
Each id can't have two timestamps. I have to print these duplicate timestamps for each id. In my above case, the output should be for rows 1,2,4,5
The following code will give the duplicate timestamp
set([x for x in df['timestamp'] if df['timestamp'].count(x) > 1])
How to consider id along with timestamp to have the duplicate rows?