[Tutor] A Python program to Summarise weather results?

Alan Gauld alan.gauld at yahoo.co.uk
Thu Aug 30 04:59:09 EDT 2018


On 30/08/18 03:56, Matthew Polack wrote:
> Hi,
> 
> We have a spreadsheet from a local weather station.....it summarises the
> amount of rainfall per day since 1863.
> 
> http://www.bom.gov.au/jsp/ncc/cdio/weatherData/av?p_nccObsCode=136&p_display_type=dailyDataFile&p_startYear=1863&p_c=-1249186659&p_stn_num=079028
> 
> We'd love to be able to summarise this into years eg. Total rainfall of
> 1863, 1864 all the way through to 2018.
> 
> Would Python be able to do this using the csv file?


Absolutely, the csv module will let you read the data.
How you process it is then up to you. If its only the
year field you want to filter by consider loading it
into a dictionary using the year as the key.

Personally, I'd put it into a SQLite database and
use SQL to do the report generation (either from
Python or via the SQLIte command line tool). That
lets you explore the data in many more interesting
ways.

But learning SQL might be a step too far at this
juncture. :-)

-- 
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