Scala data access in Jupyter
There is a copy of the iris dataset on the University of California, Irvine website at https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data . We will access this data and perform some simpler statistics on the same.
The Scala code is as follows:
import scala.io.Source; //copied file locally https://archive.ics.uci.edu/ml/ machine-learning-databases/iris/iris.data val filename = "iris.data" //DEBUGGING Uncomment this line to display more information - println("SepalLength, SepalWidth, PetalLength, PetalWidth, Class"); val array = scala.collection.mutable.ArrayBuffer.empty[Float] for (line <- Source.fromFile(filename).getLines) { var cols = line.split(",").map(_.trim); //println(s"${cols(0)}|${cols(1)}|${cols(2)}| ...
Get Learning Jupyter now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.