How can I access the entries in the csv file to perform calculations on them in F #?
I can read the csv file in memory in the usual way, but as soon as I'm stuck.
Ideally, I would just create arrays from columns and then use array.map2 to do the calculations.
So, array 1 is an indicator of website usage, and column 2 is the number of users who have reached the value in column 1 (for example, 6 visits to the website), we could calculate the average number of visits by multiplying each record in an array of column 1 , an array made from column 2, and dividing by the .sum array of column 2.
I tried the csv code for Array on F # snippets, http://fssnip.net/3T , but it creates and massages for me, which is a series of string tuples.
Can anyone suggest a better approach?
EDIT: An example of a sample input will be the same: -
Visits Count 1 8 2 9 3 5 4 3 5 2 6 1 7 1 10 1
And the output would have to return the average value of the data, in this case 2.87 (up to 2 decimal places).
EDIT 2: the current CSV output to the array I found is
val it : seq<BookWindow> = seq [{Visits = 1; Count = 8;}; {Visits = 2; Count = 9;}; {Visits = 3; Count = 5;}; {Visits = 4; Count = 3;}; ...]
which is not so useful for calculations ...