lundi 11 juillet 2016

reading and doing calculation from .dat file in python


I need to read a .dat file in python which has 12 columns in total and millions of lines of rows. I need to divide column 2,3 and 4 with column 1 for my calculation. So before I load that .dat file, do I need to delete all the other unwanted columns? If not, how do I selectively declare the column and ask python to do the math?

an example of the .dat file would be

time mass x y z - - - - -

1     1   1  1  1 ---------
 2    2   2  2  2 ---------

I am new to python , so a little instruction to open , read and calculation would be appreciated.


Aucun commentaire:

Enregistrer un commentaire