Developing the Initial Version of colStats
Learn how to develop the initial version of colStats.
We'll cover the following...
Implementing the csv2float() function
The last function we’ll implement in this file is the function csv2float() to parse
the contents of the CSV file into a slice of floating point numbers that we can
use to perform the calculations.
This function accepts two input parameters:
- An
io.Readerinterface representing the source of CSV data. - An
intrepresenting the column to extract data from.
It returns a slice of float64 numbers and a potential error:
func csv2float(r io.Reader, column int) ([]float64, error) {
Implementing the csv2float() function
This uses a similar pattern to what we’ve done previously; we’re providing
the io.Reader interface as the input parameter for ...
Ask