Skip to content

Instantly share code, notes, and snippets.

@horlabyc

horlabyc/main.go Secret

Created January 4, 2022 07:06
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 horlabyc/41dc56359a692c326c18a97ecde1267d to your computer and use it in GitHub Desktop.
Save horlabyc/41dc56359a692c326c18a97ecde1267d to your computer and use it in GitHub Desktop.
Format dataset record
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