I'm new in python. I want to read data from a csv file, and then create a graph from those data. I have a csv file with 2 columns and 20 row. In the first row I have 1 1, second row have 2 2, and so on, until 20 20. I want to take this coordinates and make graph.
This is what I have so far:
import csv
from pylab import *
with open('test.csv', 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|') # open the csv file
for row in spamreader:
print ', '.join(row) # in each loop, row is getting the data,
# first row is [1,1] , then [2,2] and so on
plot()
show()
Now, What I was thinking is to make row to be in the end, with 2 cols and 20 row with all data. Then I need to do parameter x, to be the first col, and y to be the second col, and give plot the x,y.
My problem is that I don't know how to save all values in row, and how to take only the first col and second col.
Thank you all!