tablecloth
tablecloth copied to clipboard
group-by a date column results in numerical group names
Zulip discussion: https://clojurians.zulipchat.com/#narrow/stream/151763-beginners/topic/datetime.20problem.20in.20tablecloth.20group-by
Here is a self-contained example.
Create the file d.csv as follows:
date,x
2021-01-01,1
2021-01-02,2
Then:
(require '[tablecloth.api :as tc])
(-> "d.csv"
(tc/dataset {:key-fn keyword})
(tc/group-by :date))
_unnamed [2 3]:
| :name | :group-id | :data |
|------:|----------:|---------------------|
| 18628 | 0 | Group: 18628 [1 2]: |
| 18629 | 1 | Group: 18629 [1 2]: |
The group names are turned into numbers.