September 2017
Beginner to intermediate
304 pages
7h 2m
English
We just saw that CSV data is read into Go as [][]string. However, Go is statically typed, which allows us to enforce strict checks for each of the CSV fields. We can do this as we parse each field for further processing. Consider some messy data that has random fields that don't match the type of the other values in a column:
4.6,3.1,1.5,0.2,Iris-setosa5.0,string,1.4,0.2,Iris-setosa5.4,3.9,1.7,0.4,Iris-setosa5.3,3.7,1.5,0.2,Iris-setosa5.0,3.3,1.4,0.2,Iris-setosa7.0,3.2,4.7,1.4,Iris-versicolor6.4,3.2,4.5,1.5,6.9,3.1,4.9,1.5,Iris-versicolor5.5,2.3,4.0,1.3,Iris-versicolor4.9,3.1,1.5,0.1,Iris-setosa5.0,3.2,1.2,string,Iris-setosa5.5,3.5,1.3,0.2,Iris-setosa4.9,3.1,1.5,0.1,Iris-setosa4.4,3.0,1.3,0.2,Iris-setosa
To check ...
Read now
Unlock full access