UP | HOME

Table of Contents

1. Dataset

(require '[tablecloth.api :as api])
(def DS (api/dataset {:V1 (take 9 (cycle [1 2]))
                      :V2 (range 1 10)
                      :V3 (take 9 (cycle [0.5 1.0 1.5]))
                      :V4 (take 9 (cycle ["A" "B" "C"]))}))
DS
_unnamed [9 4]:

| :V1 | :V2 | :V3 | :V4 |
|-----|-----|-----|-----|
|   1 |   1 | 0.5 |   A |
|   2 |   2 | 1.0 |   B |
|   1 |   3 | 1.5 |   C |
|   2 |   4 | 0.5 |   A |
|   1 |   5 | 1.0 |   B |
|   2 |   6 | 1.5 |   C |
|   1 |   7 | 0.5 |   A |
|   2 |   8 | 1.0 |   B |
|   1 |   9 | 1.5 |   C |
(api/dataset)
_unnamed [0 0]
(api/dataset 999)
_unnamed [1 1]:

| :$value |
|---------|
|     999 |
(api/dataset 999 {:single-value-column-name "value"
                  :dataset-name "Single value"})
Single value [1 1]:

| value |
|-------|
|   999 |
(api/dataset [[:A 33] [:B 5] [:C :a]])
_unnamed [1 3]:

| :A | :B | :C |
|----|----|----|
| 33 |  5 | :a |
(api/dataset [[:A [1 2 3 4 5 6]] [:B "X"] [:C :a]])
_unnamed [6 3]:

| :A | :B | :C |
|----|----|----|
|  1 |  X | :a |
|  2 |  X | :a |
|  3 |  X | :a |
|  4 |  X | :a |
|  5 |  X | :a |
|  6 |  X | :a |
(api/dataset {:A [1 2 3] :B "X"})
_unnamed [3 2]:

| :A | :B |
|----|----|
|  1 |  X |
|  2 |  X |
|  3 |  X |

Author: Kimi Ma

Created: 2022-05-17 Tue 07:53