Skip to content

Commit

Permalink
echarts - fetching data from the web rather than relying on another n…
Browse files Browse the repository at this point in the history
…amespace
  • Loading branch information
daslu committed Feb 10, 2025
1 parent f3ddfd7 commit 34a6634
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions notebooks/noj_book/echarts.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

(ns noj-book.echarts
(:require [tablecloth.api :as tc]
[noj-book.datasets]
[fastmath.core :as fm]
[fastmath.stats]
[scicloj.kindly.v4.kind :as kind]))
Expand Down Expand Up @@ -288,12 +287,20 @@ data-for-waterfall
;; #### Dataset Preparation
;; Before we plot any line charts, it's helpful to prepare the dataset first.

;; We will use the stocks dataset from the
;; [TMD's repo](https://github.com/techascent/tech.ml.dataset/tree/master/test/data).

(defonce stocks
(tc/dataset
"https://raw.githubusercontent.com/techascent/tech.ml.dataset/master/test/data/stocks.csv"
{:key-fn keyword}))

;; This dataset originally contains three columns:
(tc/head noj-book.datasets/stocks)
(tc/head stocks)

;; To make it better serve this tutorial, let's widen it:
(def reshaped-stocks
(-> noj-book.datasets/stocks
(-> stocks
(tc/pivot->wider [:symbol] [:price] {:drop-missing? false})
(tc/rename-columns keyword)))

Expand Down

0 comments on commit 34a6634

Please sign in to comment.