mardi 26 juillet 2016

Python - How to Compare a column value of one row with value in next row

I want to compare the S.No. of different rows, if it is same then I want to calculate the datetime difference and print details.(If datetime difference is not possible then only date difference would also be fine.)

Input

S.No.   Datetime    Details

1    2010/6/7 19:01 asd 

1    2010/6/8 4:00  dfg 

2    2010/6/9 0:00  dfg 

2   2010/6/10 0:00  gfd 

2   2010/6/11 0:00  gfd 

3   2010/6/12 0:00  gfd 

3   2010/6/13 0:00  abc 

4   2010/6/14 0:00  abc 

4   2010/6/15 0:00  def 

Expected output

1   0.3 asd dfg

2   1   dfg gfd

2   1   gfd gfd

3   1   gfd abc

4   1   abc def

Aucun commentaire:

Enregistrer un commentaire