[Tutor] Collating date data from a csv file

Alan Gauld alan.gauld at yahoo.co.uk
Thu May 9 12:51:38 EDT 2019


On 09/05/2019 14:06, Dave Hill wrote:
> Thank you, I now have
> 
> defaultdict(<class 'int'>, {736697: 10, 736677: 14, 736980: 9, 737109: 
> 50, 736919: 15, 736652: 19, 736502: 14, 736710: 2, 736674: 6, 736672: 5, 
> 736933: 2, 736932: 6, 736658: 7, 736671: 5, 736499: 6, 736707: 4, 
> 737181: 4, 736686: 2, ...
> 
> where the first number is the proleptic Gregorian ordinal of the date 
> 8-) ( I had to look up what proleptic meant)
> 
> This means I can access the elements by the ordinal of the date, for 
> later processing, and extraction to a spreadsheet

It might be easier to use a DateTime object instead of the ordinal.
It might make printing the results easier later on. You'll find
it in the datetime module...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list