Fork me on GitHub
#data-science
<
2022-09-27
>
Kamuela10:09:51

With tablecloth, is a single column considered a "Series" in a way similar to pandas? I'm having trouble understanding why I can't use dfn/mean on a single column Dataset

respatialized12:09:26

Are you trying to use the whole Dataset object as an argument to dfn/mean? I don't think there's that kind of polymorphism built in - you'd have to call tablecloth.api/column or tablecloth.api/map-columns to operate on the column within the dataset.

genmeblog13:09:47

There is no such polymorphism. You need to pass a column object, eg. (dfn/mean (ds :column-name))

Kamuela13:09:04

So maybe my initial sin is using tc/select-colums to select only one column? That creates a Dataset, that's why I was trying to figure out if a single column becomes a "series" or something like that because it seems like that's what dfn/mean expects to operate on

genmeblog13:09:05

select-columns creates a dataset with a subset of columns. To select a column use a dataset as a map or call tc/column . More about it here: https://scicloj.github.io/tablecloth/index.html#Columns_and_rows

genmeblog13:09:40

dfn/mean (and any other dfn functions) operates on a dtype-next buffer, Clojure sequence or a Column object but not on a dataset itself.

Kamuela16:09:50

Thank you, by the way. tc/column solved everything

👍 1