-
-
Save horlabyc/41dc56359a692c326c18a97ecde1267d to your computer and use it in GitHub Desktop.
Format dataset record
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
package main | |
import ( | |
"encoding/csv" | |
"log" | |
"os" | |
"strconv" | |
) | |
func formatRecords(records [][]string) ([]string, []float64) { | |
gameNames := []string{} | |
sales := []float64{} | |
for _, r := range records[1:] { | |
gameNames = append(gameNames, r[0]) | |
val, _ := strconv.ParseFloat(r[1], 64) | |
sales = append(sales, val) | |
} | |
return gameNames, sales | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment