Created
June 17, 2018 14:24
-
-
Save NMZivkovic/ee4ebdd58ed65cc72d9f4e36f91a567c to your computer and use it in GitHub Desktop.
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
public class IrisCsvReader | |
{ | |
public IEnumerable<IrisFlower> GetIrisDataFromCsv(string dataLocation) | |
{ | |
return File.ReadAllLines(dataLocation) | |
.Skip(1) | |
.Select(x => x.Split(',')) | |
.Select(x => new IrisFlower() | |
{ | |
SepalLength = float.Parse(x[0]), | |
SepalWidth = float.Parse(x[1]), | |
PetalLength = float.Parse(x[2]), | |
PetalWidth = float.Parse(x[3]), | |
Label = x[4] | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment