tablecloth icon indicating copy to clipboard operation
tablecloth copied to clipboard

specifying the type on add-or-remove-column

Open daslu opened this issue 4 years ago • 3 comments

Currently (checked with https://github.com/scicloj/tablecloth/commit/a067803de29daf58240f720014cd02b6fa4bca46), it is possible to specify the type of a new column using a call to dtype-next.

(-> {:x [1 2]}
    (tablecloth.api/dataset)
    (tablecloth.api/add-or-replace-column
     :y (tech.v3.datatype/as-reader [1 2] :float32))
    :y)

#tech.v3.dataset.column<float32>[2]
:y
[1.000, 2.000, ]

It could be nice to allow that directly as an option of the tablecloth API, without requiring the user to know what a "reader" is.

daslu avatar Jan 11 '21 13:01 daslu

Definitely user shouldn't know about the reader. There is a function for explicit datatype conversion (convert-types) which can be called after insterting a column. To enable add-or-remove-column probably API should be changed to accept a map as the last parameter. Currently it contains size-strategy. We need to think how to avoid breaking change here.

genmeblog avatar Jan 11 '21 14:01 genmeblog

@genmeblog Can I pick this up?

ashimapanjwani avatar Feb 19 '21 21:02 ashimapanjwani

Yes! Thanks.

genmeblog avatar Feb 19 '21 23:02 genmeblog