Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scala.io.Source
- import elections._
- object Zad2 extends App {
- val wojewodztwa = Source
- .fromResource("wojewodztwa.csv")
- .getLines
- .toList
- .map(l => {
- l.split(",").toList match {
- case List(a, b) => Województwo(a, b.toInt)
- }
- })
- val gminy = Source
- .fromResource("gminy.csv")
- .getLines
- .toList
- .map(l => {
- l.split(",").toList match {
- case List(name,id,votes) => Gmina(name,id.toInt,votes.toInt)
- }
- })
- val wyniki = Source
- .fromResource("wyniki.csv")
- .getLines
- .toList
- .map(l => {
- l.split(",").toList.map(_.toInt) match {
- case List(id,a,b,c,d,e,f,g,h,i,j) => Wynik(id,a,b,c,d,e,f,g,h,i,j)
- }
- })
- val agregatedResults = wyniki.groupBy(x => (x.ID /10000).toInt)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement