LINQ to CSV

Enoch84

New member
Joined
Oct 15, 2008
Messages
3
Location
Oklahoma
Programming Experience
Beginner
I am wondering if ther is a way to load a .csv file that may have up to 100+ columns and use LINQ to load and read the file and be able to sum up or do other caculations by refrencing the header name if it exisits. For example here is a few columns form one of the .csv files:



Date Time Suction Rate ACC1 (BBL/min) Inline Pressure (PSI)
9/22/2008 6:56:15 83.574936 89.39003
9/22/2008 6:56:16 83.581558 85.632057
9/22/2008 6:56:17 83.574181 86.061066
9/22/2008 10:02:26 37.147488 -11.832589
9/22/2008 10:02:27 37.275013 -12.781921
9/22/2008 10:02:28 37.275013 -14.381091
9/22/2008 10:02:29 42.418762 -11.376641
9/22/2008 10:02:30 42.418762 -10.719541
9/22/2008 10:02:31 42.418762 -11.213204
9/22/2008 10:02:32 46.316887 -11.213204
9/22/2008 10:02:33 51.63966 -8.699904
9/22/2008 10:02:34 51.63966 -9.305041
9/22/2008 10:02:35 51.63966 -9.305041
9/22/2008 10:02:36 55.36021 -13.821773
9/22/2008 10:02:37 48.948078 -11.212646
9/22/2008 10:02:38 48.948078 -11.900478
9/22/2008 10:02:39 40.535667 4.356627
9/22/2008 10:02:40 50.523308 4.771786
9/22/2008 10:02:41 50.523308 6.731355
9/22/2008 10:02:42 74.679581 8.583921
9/22/2008 10:02:43 74.679581 8.583921
9/22/2008 10:02:44 89.318382 8.854082
9/22/2008 10:02:45 89.318382 10.430343




What Im trying to do is get the average if the value is non negative of Column "Suction Rate ACC1 (BBL/min)" and get the maximum value in column "Inline Pressure (PSI)"

The column order may change from .csv file to .csv file which is why I need to get the values out of the column by its header name instead of trying to use a fixed index.
 

Latest posts

Back
Top