scicloj / tablecloth

Dataset manipulation library built on the top of tech.ml.dataset
https://scicloj.github.io/tablecloth
MIT License
305 stars 27 forks source link

reorder-columns on empty dataset returns nil #36

Closed behrica closed 3 years ago

behrica commented 3 years ago

It feels wrong. An empty dataset is "a dataset", so no operation on it should return nil, I believe.

(tc/reorder-columns (tc/dataset {}) [:what-ever])
-> nil
genmeblog commented 3 years ago

reorder-columns relies on tech.v3.dataset/select-columns. Seems that TMD returns nil in this case. I need to check it and when it's true I'll fill an issue in TMD.

genmeblog commented 3 years ago

Confirmed:

(ds/select-columns (ds/->dataset {}) [])
;; => nil
genmeblog commented 3 years ago

btw. if you want an empty dataset with TC just call (tc/dataset)