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:
Plotting data with python and pylab
View more documents from Giovanni Dall’Olio.
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 🙁
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
csvfile.seek(0)
# 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()
csvfile.close()
Enjoy!