954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Trying to manipulate and graph *csv file

I am currently trying to take two columns from a *.csv file... log10 transform them, and then plot them up on a graph. The graph is not the issue, I just need to edit those two columns and plot them. The file does have a header row, there are 8 columns, and I would like to edit/use columns 5 and 7. None of the cookbooks or references I have found provide any good direction... Can anyone help me out?

Sargasso
Newbie Poster
2 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

Something like this...

f_in = open('file.csv')
lines = f_in.readlines()[1:]
fields = [item for item in lines.split(',')]
selected = []
for field in fields:
    selected.append((field[4], field[6]))


It will need adjusting...

Cheers and Happy coding

Beat_Slayer
Posting Pro in Training
405 posts since Jun 2010
Reputation Points: 30
Solved Threads: 105
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: