// readCrimes reads CSV data from a file identified by filename.
readCrimes reads CSV data from a file identified by filename.
// readCrimes reads CSV data from a file identified by filename .
func readCrimes(filename string) (CsvRows, error) {
	f, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	reader := csv.NewReader(f)
	reader.TrailingComma = true
	rows, err := reader.ReadAll()
	if err != nil {
		return nil, err
	}
	filteredRows := make(CsvRows, 0)
	for _, row := range rows {
		if row[8] == "" || row[9] == "" {
			continue
		}
		if !isFloat(row[8]) || !isFloat(row[9]) {
			continue
		}
		filteredRows = append(filteredRows, row)
	}
	return filteredRows, nil
}
func readCrimes ( filename string ) ( CsvRows , error ) { f , err := os . Open ( filename ) if err != nil { return nil , err } reader := csv . NewReader ( f ) reader . TrailingComma = true rows , err := reader . ReadAll ( ) if err != nil { return nil , err } filteredRows := make ( CsvRows , 0 ) for _ , row := range rows { if row [ 8 ] == " " || row [ 9 ] == " " { continue } if ! isFloat ( row [ 8 ] ) || ! isFloat ( row [ 9 ] ) { continue } filteredRows = append ( filteredRows , row ) } return filteredRows , nil }
readCrimes reads CSV data from a file identified by filename.
readCrimes reads CSV data from a file identified by filename .