Hi, On 19 July 2013 20:24, Sivaram Neelakantan <nsivaram....@gmail.com> wrote:
> > I've got some stock indices data that I plan to plot using matplotlib. > The data is simply date, idx_close_value and my plan is to plot the > last 30 day, 90, 180 day & all time graphs of the indices. > > a) I can do the date computations using the python date libs > b) plotting with matplotlib, I can get that done > > what is the best way to split the file into the last 30 day recs, 90 > day recs when the data is in increasing time order? My initial > thinking is to first reverse the file, append to various 30/90/180 day > lists for every rec > computed date for the corresponding date > windows. > > Is that the way to go or is there a better way? You can do things manually as Peter's suggested, there's some value to be had from learning to do things "by hand". However, if you're going to continue to work with matplotlib and stock data I highly recommend you eventually pick up and learn Pandas: http://pandas.pydata.org/ Another useful link: https://bitbucket.org/hrojas/learn-pandas Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor