I have two dataframes, I want to reduce the information in the first dataframe that looks like:
event_timestamp message_number an_robot
2015-04-15 12:09:39 10125 robot_7
2015-04-15 12:09:41 10053 robot_4
2015-04-15 12:09:44 10156 robot_7
2015-04-15 12:09:47 20205 robot_108
2015-04-15 12:09:51 10010 robot_38
2015-04-15 12:09:54 10012 robot_65
2015-04-15 12:09:59 10011 robot_39
My other dataframe looks like this:
sequence support
10053,10156,20205 0.94783
10010,10012 0.93322
I want to replace all the sequences that are in dataframe 1, that are apparent in dataframe 2. So the new dataframe should be:
event_timestamp message_number an_robot
2015-04-15 12:09:39 10125 robot_7
2015-04-15 12:09:41 10053,10156,20205 robot_4,robot_7,robot_108
2015-04-15 12:09:51 10010,10012 robot_38,robot_65
2015-04-15 12:09:59 10011 robot_39
Anybody who knows how to achieve this? I know how to find if the values match up in exactly one row, but not comparing multiple rows that have to be exactly after each other.
--- EDIT ---
maybe to make it a bit more simple, it would also be fine to generate a new message_number for a sequence. So the new dataframe could be:
event_timestamp message_number an_robot
2015-04-15 12:09:39 10125 robot_7
2015-04-15 12:09:41 1 robot_4,robot_7,robot_108
2015-04-15 12:09:51 2 robot_38,robot_65
2015-04-15 12:09:59 10011 robot_39
Where each sequence found in the sequence dataframe would be written as a 0, 1, 2, 3 or 4 (till the last sequence). I could always update the database with the meaning of the message_number codes with these new numbers. It would be great though to keep the information about which robot did it, but if that is too complex then this is fine as well.