I wrote a script that will take a data point for one coordinate and create a file. Now I want to create a file per column with each of the row headers as well (including the data). Can't seem to figure it out in my script this is what I have so fa, but it's still doing the original operation.

OK, now I understand better what you want to do. I would still like to see a data sample so that I could try to run your program if needed.

After a quick look at your code, I can see a number of opportunities for improvement, but don't see anything blatantly wrong. So, my first question: is your program doing what you want? If not, what is wrong in your output? Or is it slow? Well, what is the problem you wish us to address?

I have uploaded an example file to run and also what I would like to recieve. I wrote the script initially to extract one data point (see above example) but now I would like all data points for each animal in an individual file, and I can't figure out how to rewrite my script to accomplish the task. I appreciate you taking the time to understand my problem, does that make more sense?