Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created June 23, 2018 13:27
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 NMZivkovic/c5455387cfcecf3ba886d43d07c9ded1 to your computer and use it in GitHub Desktop.
Save NMZivkovic/c5455387cfcecf3ba886d43d07c9ded1 to your computer and use it in GitHub Desktop.
public class BikeSharingDemandsCsvReader
{
public IEnumerable<BikeSharingDemandSample> GetDataFromCsv(string dataLocation)
{
return File.ReadAllLines(dataLocation)
.Skip(1)
.Select(x => x.Split(','))
.Select(x => new BikeSharingDemandSample()
{
Season = float.Parse(x[2]),
Year = float.Parse(x[3]),
Month = float.Parse(x[4]),
Hour = float.Parse(x[5]),
Holiday = int.Parse(x[6]) != 0,
Weekday = float.Parse(x[7]),
Weather = float.Parse(x[8]),
Temperature = float.Parse(x[9]),
NormalizedTemperature = float.Parse(x[10]),
Humidity = float.Parse(x[11]),
Windspeed = float.Parse(x[12]),
Count = float.Parse(x[15])
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment