I have a dataframe looks like :
id TakingTime
1 03-01-2015
1 18-07-2015
1 22-10-2015
1 14-01-2016
2 11-02-2015
2 28-02-2015
2 18-04-2015
2 19-05-2015
3 11-02-2015
3 16-11-2015
3 19-02-2016
3 21-04-2016
4 03-01-2015
4 03-01-2015
4 03-01-2015
4 03-01-2015
The output desired is :
id TakingTime
1 03-01-2015
1 18-07-2015
1 22-10-2015
1 14-01-2016
3 11-02-2015
3 16-11-2015
3 19-02-2016
3 21-04-2016
When I want to remove all id which have a difference time between the first and last taking time one year minimum.
I tried with
df[df.groupby('ID')['takingtime'].transform(lambda x: x.nunique() > 1)]
But I'm not sure if it's the right way to do this and if yes what is meaning of > 5
? Days, Months, Years ... ?