Skip to content

Commit

Permalink
Sketch section on loading data
Browse files Browse the repository at this point in the history
  • Loading branch information
noelwelsh committed Oct 25, 2024
1 parent 3c537a6 commit 841544d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions book/src/pages/2-explore/loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,37 @@ Acquiring data, and transforming it into a workable state, can be one of the mos

Open up the file `Explore.scala`

`data` is defined. Let's take a sneak peek at it.

```scala
creativescala.Explore.data
val res0: List[creativescala.data.HadCrut5.Record] =
List(
Record(1850,1,-0.67456436,-0.98177195,-0.3673568),
Record(1850,2,-0.333416,-0.700901,0.034069024),
Record(1850,3,-0.59132266,-0.9339191,-0.2487262),
...
```

Explain the data.

`Record` is year, month, anomaly, lower, upper.

What is a `List`? Zero or more elements, with a defined order.

How can we get an understanding of the data?

```scala
creativescala.Explore.data.size
// 2082
```

```scala
creativescala.Explore.data.head
// creativescala.data.HadCrut5.Record = Record(1850,1,-0.67456436,-0.98177195,-0.3673568)
```

This won't scale. Better to visualize the data.
What should we visualize? For each year as a line of month versus anomaly.

[template]: https://github.com/creativescala/creative-scala-data-template
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ lazy val build = taskKey[Unit]("Build the book")

val commonSettings = Seq(
libraryDependencies ++= Seq(
"org.creativescala" %%% "doodle" % "0.23.0"
"org.creativescala" %%% "doodle" % "0.23.0",
"org.creativescala" %%% "chartreuse-core" % "0.2.0"
)
)

Expand Down

0 comments on commit 841544d

Please sign in to comment.