|
150 | 150 | (:require |
151 | 151 | ;; Tablecloth - Dataset manipulation |
152 | 152 | [tablecloth.api :as tc] |
153 | | - [tablecloth.column.api :as col] |
| 153 | + [tablecloth.column.api :as tcc] |
154 | 154 |
|
155 | 155 | ;; Kindly - Notebook visualization protocol |
156 | 156 | [scicloj.kindly.v4.kind :as kind] |
|
394 | 394 | ;; - Why: transforms need domains first; rendering libs handle layout better |
395 | 395 | ;; |
396 | 396 | ;; **4. Type-aware grouping** |
397 | | -;; - Tablecloth gives us column types via `col/typeof` for free |
| 397 | +;; - Tablecloth gives us column types via `tcc/typeof` for free |
398 | 398 | ;; - Categorical aesthetics (`:=color :species`) create groups for transforms |
399 | 399 | ;; - Continuous aesthetics are visual-only (no grouping) |
400 | 400 | ;; - Explicit `:=group` aesthetic for manual control |
|
533 | 533 | ;; computing derived data. So we compute: |
534 | 534 | ;; - Statistical transforms (histogram bins, regression lines) |
535 | 535 | ;; - Domains when needed (always for `:geom`, only custom for `:vl`/`:plotly`) |
536 | | -;; - Type information (from Tablecloth's `col/typeof`) |
| 536 | +;; - Type information (from Tablecloth's `tcc/typeof`) |
537 | 537 | ;; |
538 | 538 | ;; We delegate to rendering targets: |
539 | 539 | ;; - Axis rendering, tick placement, "nice numbers" |
|
1831 | 1831 | row-facet (:=row layer) |
1832 | 1832 |
|
1833 | 1833 | ;; Helper to check if a column is categorical |
1834 | | - ;; Uses Tablecloth's col/typeof when available, falls back to value inspection |
| 1834 | + ;; Uses Tablecloth's tcc/typeof when available, falls back to value inspection |
1835 | 1835 | categorical? (fn [col-key] |
1836 | 1836 | (when (and col-key dataset) |
1837 | 1837 | (let [col-type (try |
1838 | 1838 | ;; Primary: Get type from Tablecloth metadata |
1839 | | - (col/typeof (get dataset col-key)) |
| 1839 | + (tcc/typeof (get dataset col-key)) |
1840 | 1840 | (catch Exception _ |
1841 | 1841 | ;; Fallback: Infer from values for plain Clojure data |
1842 | 1842 | (infer-from-values (get dataset col-key))))] |
@@ -2353,9 +2353,9 @@ iris |
2353 | 2353 | ;; Tablecloth provides precise type information for each column, which we use |
2354 | 2354 | ;; for type-aware grouping and aesthetic mapping. |
2355 | 2355 |
|
2356 | | -{:bill-length-type (col/typeof (penguins :bill-length-mm)) |
2357 | | - :species-type (col/typeof (penguins :species)) |
2358 | | - :island-type (col/typeof (penguins :island))} |
| 2356 | +{:bill-length-type (tcc/typeof (penguins :bill-length-mm)) |
| 2357 | + :species-type (tcc/typeof (penguins :species)) |
| 2358 | + :island-type (tcc/typeof (penguins :island))} |
2359 | 2359 |
|
2360 | 2360 | ;; Notice: We get precise type information (`:float64`, `:string`) without |
2361 | 2361 | ;; examining values. This eliminates the need for complex type inference. |
@@ -2919,7 +2919,7 @@ iris |
2919 | 2919 |
|
2920 | 2920 | ;; **What happens here**: |
2921 | 2921 |
|
2922 | | -;; 1. Dataset is grouped by `:species` (categorical column detected via Tablecloth's `col/typeof`) |
| 2922 | +;; 1. Dataset is grouped by `:species` (categorical column detected via Tablecloth's `tcc/typeof`) |
2923 | 2923 | ;; 2. Three separate OLS regressions computed (one per species) |
2924 | 2924 | ;; 3. Three regression lines rendered with matching colors |
2925 | 2925 | ;; 4. Demonstrates type-aware grouping for statistical transforms |
@@ -4641,15 +4641,15 @@ iris |
4641 | 4641 | ;; ```clojure |
4642 | 4642 | ;; (try |
4643 | 4643 | ;; ;; Primary: Get type from Tablecloth metadata |
4644 | | -;; (col/typeof (get dataset col-key)) |
| 4644 | +;; (tcc/typeof (get dataset col-key)) |
4645 | 4645 | ;; (catch Exception _ |
4646 | 4646 | ;; ;; Fallback: Simple inference for plain Clojure data |
4647 | 4647 | ;; (infer-from-values (get dataset col-key)))) |
4648 | 4648 | ;; ``` |
4649 | 4649 |
|
4650 | 4650 | ;; **How it works:** |
4651 | 4651 |
|
4652 | | -;; 1. **Tablecloth datasets (primary path)** - Use `col/typeof` to get precise type information |
| 4652 | +;; 1. **Tablecloth datasets (primary path)** - Use `tcc/typeof` to get precise type information |
4653 | 4653 | ;; - Returns types like `:float64`, `:string`, `:int32`, etc. |
4654 | 4654 | ;; - Free, accurate, no guessing required |
4655 | 4655 | ;; - This is why we convert plain data to datasets via `ensure-dataset` |
|
0 commit comments