writing reading from a csv or txt file

Discussion in 'Python' started by mtcplumb, Mar 30, 2014.

  1. mtcplumb

    mtcplumb Guest

    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.
     
    mtcplumb, Mar 30, 2014
    #1
    1. Advertisements

  2. Hi I have 3 csv files with a list of 5 items in each.
    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
     
    Joseph L. Casale, Mar 30, 2014
    #2
    1. Advertisements

  3. mtcplumb

    Gary Herron Guest

    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
     
    Gary Herron, Mar 30, 2014
    #3
  4. remember to add you answer at the bottom, not the top).
    Please also remember to reply-all.
     
    Jason Friedman, Apr 2, 2014
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.