[SciPy-User] calculate new values in csv using numpy

Johannes Radinger johradinger at googlemail.com
Mon Jul 18 06:17:34 EDT 2011


Hello,

I try to load a csv-file (created with excel) and want to calculate a new
value.
Lets say my file has columns A,B and C and I want to calculate A*B-C and
append
it in the correct line.

So far I managed to get the file read with:
table = numpy.genfromtxt("/path/to/file.csv", dtype=None, delimiter=';',
skip_header=1)

But how do I have to proceed to get the single columns. I know that I have
to use after that a FOR-loop to loop over the lines to do the calculation.

so there are the two questions:
1) how to extract the single columns?
2) how to append a new columns containing the calculated value?

best regards
/johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110718/79a1c73b/attachment.html>


More information about the SciPy-User mailing list