Skip to content

Instantly share code, notes, and snippets.

@isaacabraham
Last active October 19, 2015 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacabraham/0e9c830bf9fb2346c37b to your computer and use it in GitHub Desktop.
Save isaacabraham/0e9c830bf9fb2346c37b to your computer and use it in GitHub Desktop.
let prices : (int * float) array =
[ "http://publicdata.landregistry.gov.uk/market-trend-data/price-paid-data/a/pp-2015.csv" ]
|> CloudFlow.OfHttpFileByLine // Stream the HTTP file across the cluster
|> CloudFlow.map (HousePrices.ParseRows >> Seq.head) // Convert from raw text to our CSV Provided type
|> CloudFlow.groupBy(fun row -> row.DateOfTransfer.Month) // Group by month
|> CloudFlow.map(fun (month, rows) -> month, rows |> Seq.averageBy (fun row -> float row.Price)) // Get the average price for each month
|> CloudFlow.toArray
|> cluster.Run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment