PDA

View Full Version : to group successive datasets using pandas in python



madhu91
March 8th, 2013, 04:46 AM
hello. I have a huge GPS datasets of the form (id,timestamp,longitude,latitude). Something like this

id
timestamp
longitude
latitude


3
2001-02-02 13:02:01
132.3245
56.2345


3
2001-02-02 13:02:06
132.3245
56.2345


3
.........
same as above
same as above



....
....
....


3
2001-02-02 13:05:01
132.3245
56.2345


3
2001-02-02 13:05:06
132.3246
56.2345


the above is just an example of how my data is present. I have around 990000 records roughly. now i want something like this


id
timestamp
longitude
latitude


3
2001-02-02 13:02:01 - 2001-02-02 13:05:01
132.3245
56.2345


3
2001-02-02 13:05:06
132.3246
56.2345


i want to merge all the rows of same latitude and longitude values into a single row. I am a beginner in pandas and i cannot use "group by" function where group by groups all the occurances but i want successive occurances to be grouped.

any help would be surely appreciated. :)
thank you very much..

coffeecat
March 10th, 2013, 07:48 PM
Thread moved to Programming Talk, at request of OP.