how to read and plot a CSV file with python and pylab

Today I gave a small introductive talk to how to read a CSV file and create some plots with python and pylab.

Here you have the slides:

I have uploaded them on slideshare and created a blog post here, as I used to do in my former poor and once-glorious blog 🙁

One Comment

  1. Hi,

    The csv Python module is also very nice.
    For instance:

    # open csv file
    csvfile = open("test.csv")
    # read file content
    dialect = csv.Sniffer().sniff(csvfile.readline())
    # go back to the beginning
    # create a iterable object
    # dialect=dialect lets the csv module finds what is the separator
    reader = csv.DictReader(csvfile, dialect=dialect)
    # each item is a dictionary with column headers as keys
    for r in reader:
    print r.values()


Leave a Reply