On Sat, May 19, 2012 at 1:58 PM, <[email protected]> wrote: > I confese I haven't read your entire email, but have you looked at pyR? I > believe it is a wrapper for python, giiving you access to r. > > > Sent from my Verizon Wireless BlackBerry > > -----Original Message----- > From: Benjamin G <[email protected]> > Sender: [email protected] > Date: Sat, 19 May 2012 13:46:42 > To: <[email protected]> > Subject: [Tutor] Translating R Code to Python-- reading in csv files, > writing out to csv files > > _______________________________________________ > Tutor maillist - [email protected] > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > > _______________________________________________ > Tutor maillist - [email protected] > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor
I am not sure I understand what you want to do. Could you show a few lines of your input data and then show how you want it to look once it is processed? The csv module is pretty easy to get going. If your goal is to learn python I would check the documentation or find a csv tutorial http://docs.python.org/library/csv.html The reader will either write to python list or dict. If you use the list, you access each item with my_list[n] where n is the position (starting with 0). If you need to change the data, you can do that to the list items. If you need to output in a different order, or just some fields try this: in_date: [1, 2, 3] --> out_data [2,1,3] would code like this: out_data[] out_data.append[1] out_data.append[0] out_data.append[2] Then use the csv writer to write out_data to your file I don't know R, but most python people will tell you its best to learn the 'python way', and not try to 'translate' from another language. -- Joel Goldstick _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
