By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,789 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,789 IT Pros & Developers. It's quick & easy.

Plot dates in int format against values

P: 1
I have a list of values in an array named V that i need to plot against a list of "dates". At the moment the dates are in an array (spanning 6 months) in the format date=['20130322", '20130323', '20130324' etc]
How do i convert these dates into dates that can be sensibly plotted?
Sep 13 '12 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,851
The dates can be formatted for display using the time module.
Expand|Select|Wrap|Line Numbers
  1. >>> import time
  2. >>> dates = ['20130322', '20130323', '20130324']
  3. >>> print "\n".join([time.strftime('%b %d, %Y', time.strptime(d, '%Y%M%d')) for d in dates])
  4. Jan 22, 2013
  5. Jan 23, 2013
  6. Jan 24, 2013
  7. >>> 
Sep 14 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.