I need to analyse some data, stored in csv files. Each file represents the output of 3 devices, each with a different data sampling rate and a different time stamping convention. I would like to match timestamps from each csv file so that I can collate all the data from a single subject into a single file and use that to put into R.
The different timestamp conventions are below
Device 1 (Galvanic skin response):
04/12/2012 14:17
Device 2 (Heart rate monitor):
14:16:13
Device 3 (the actual task we are asking subjects to perform):
134941
Which I think means 13:49:41.
I know the dates each experiment was performed on, so it’s just the times I need to match against.
The data represent heart rate, galvanic skin response of subjects and the result of the user input to the tablet. I need to correlate their performance on the task with the changes in skin conductivity and heart rate – hence why I need to match up these times.
For example, there is a single file per person for skin response and a separate one heart rate but multiple files (with similar times) for the performance on our task depending on the various experimental conditions we used. I’d rather not do this matching task personally as there are ~ 300 of these files.
Use the time module’s strptime() method to parse the dates into time objects and strftime() to print out in specific formats (if needed).
Example:
Be aware that any parsed times that are only hours/minutes/seconds or any subset thereof will default to having a date of 1900-01-01. But if all you’re doing is pulling the time portions from the parsed struct_time objects, it won’t affect you. Otherwise, you’ll need to assign them the correct date when you parse the strings: