Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func parseCSVFile(filePath string) []LabelWithFeatures {
- fileContent, _ := ioutil.ReadFile(filePath)
- lines := bytes.Split(fileContent, newline)
- numRows := len(lines)
- labelsWithFeatures := make([]LabelWithFeatures, numRows-2)
- for i, line := range lines {
- // skip headers
- if i == 0 || i == numRows-1 {
- continue
- }
- labelsWithFeatures[i-1] = NewLabelWithFeatures(bytes.Split(line, comma))
- }
- return labelsWithFeatures
- }
Add Comment
Please, Sign In to add comment