writing reading from a csv or txt file

M

mtcplumb

Hi I have 3 csv files with a list of 5 items in each.
rainfall in mm, duration time,time of day,wind speed, date.
I am trying to compare the files. cutting out items in list list. ie:-
first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date.
first file (rainfall2013.csv)rainfall, duration,time of day,wind speed,date.
I would like to pick out maybe rainfalls and duration's and measure against say years.
I would like to very the items from the rows.
could you please advise me where i can find such information. or book, textbook.
 
J

Joseph L. Casale

Hi I have 3 csv files with a list of 5 items in each.
rainfall in mm, duration time,time of day,wind speed, date.
I am trying to compare the files. cutting out items in list list. ie:-
first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date.
first file (rainfall2013.csv)rainfall, duration,time of day,wind speed,date.
I would like to pick out maybe rainfalls and duration's and measure against
say years.
I would like to very the items from the rows.
could you please advise me where i can find such information. or book,
textbook.

How about we help you here..

So if you want to compare by year, you want to read all the rows in and perform
some math, because I can't help myself, I push this into sqlite at least but that's
probably overkill for you (besides the limitless benefits:)). You want to store some
state while you iterate over each row in the csv, appending data, then finally performing
some statistical math on the collection.

You will do this for each file, then finally aggregate your results.

jlc
 
G

Gary Herron

Hi I have 3 csv files with a list of 5 items in each.
rainfall in mm, duration time,time of day,wind speed, date.
I am trying to compare the files. cutting out items in list list. ie:-
first file (rainfall2012.csv)rainfall, duration,time of day,wind speed,date.
first file (rainfall2013.csv)rainfall, duration,time of day,wind speed,date.
I would like to pick out maybe rainfalls and duration's and measure against say years.
I would like to very the items from the rows.
could you please advise me where i can find such information. or book, textbook.

How is this a Python question?

There is a standard module included with Python for reading CSV files.
Would you like to know how to use that? You can find documentation on
it here:
http://docs.python.org/3/library/csv.html

Gary Herron
 
J

Jason Friedman

Hi jason thanks for replying.Below is a typical file return.To you I've no
doubt this is a simple problem but,to a beginner like me it just seems I
lack the understanding of how to split out the items in a list.Thanks again
for looking at it.
Rainfall,duration,TimeStart,windspeed,Date
0.1,5,05:25,3.1,03/02/2013
0.12,8,11:20,4.1,03/02/2013
0.1,2,18:05,2.8,03/02/2013
18,15,04:03,4.5,04/02/2013
2.3,6,17:02,2.4,04/02/2013
***********************************************
Rainfall,duration,TimeStart,windspeed,Date
1.1,5,05:25,3.1,014/02/2012
1.32,8,14:20,4.1,14/02/2012
2.1,2,22:00,2.8,14/02/2012
18,15,03:30,4.5,18/02/2012
1.3,4,13:00,2.4,18/02/2012


I am trying to compare the files. cutting out items in list list. ie:-
remember to add you answer at the bottom, not the top).
Please also remember to reply-all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top