Created
June 10, 2015 05:02
-
-
Save sudipto80/e5ac68b0b04a4d78a3a5 to your computer and use it in GitHub Desktop.
Titanic Surviver Analysis using Squirrel (https://github.com/sudipto80/Squirrel/blob/master/ScreenCastDemos/example-06.md)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r @"C:\Users\mukhsudi\Documents\GitHub\SquirrelLatest\ConsoleApplication2\bin\Debug\TableAPI.dll" | |
//type NameAndSex = {Name : string ; Sex : string} | |
type SurvivalStat = {PClass : string; Died : float; Survived :float} | |
let titanic = Squirrel.DataAcquisition.LoadCSV(@"C:\titanic.csv") | |
let classes = titanic.SplitOn("Pclass") | |
let result = new Squirrel.Table() | |
let pClasses = [|"1";"2";"3"|] | |
let persons = pClasses |> Array.map ( fun pClass -> | |
{ | |
PClass = pClass; | |
Died=classes.[pClass].GetPercentage("Survived", "0"); | |
Survived=classes.[pClass].GetPercentage("Survived", "1") | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment