Created
June 23, 2018 13:27
-
-
Save NMZivkovic/c5455387cfcecf3ba886d43d07c9ded1 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 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