You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One would expect the following to create a dataset with 2 columns and rows populated with the data from each tuple, but you get an unexpected result (a 3x2 dataset)
(tc/dataset [["a" 2] ["b" 3] ["c" 4]] {:column-names ["Col A" "Col B"]})
;; >>>
| a | b | c |
|--:|--:|--:|
| 2 | 3 | 4 |
(as opposed to)
| Col A | Col B |
|------:|------:|
| a | 2 |
| b | 3 |
| c | 4 |
One possible solution is to just remove this special handling of 2-element iterables and issue a breaking release, another might be to handle the case where a map is given (which seems to be what this is trying to catch, I think?), but not apply the same logic to all 2-element seqs (which would still be a breaking change).
I'd be happy to contribute a PR once a decision is made about if/how to address this issue.
The text was updated successfully, but these errors were encountered:
kiramclean
changed the title
Unexpected results when instantiating a dataset from a array of 2-element arrays where one element is a string or keyword
Unexpected results when instantiating a dataset from array of 2-element arrays where one element is a string or keyword
Mar 21, 2024
kiramclean
changed the title
Unexpected results when instantiating a dataset from array of 2-element arrays where one element is a string or keyword
Unexpected results when instantiating a dataset from array of 2-element arrays where first element is a string or keyword
Mar 21, 2024
Following [removal of inconsistent method for forming datasets from
arrays of 2-element arrays where first element is a string or
keyword](scicloj/tablecloth#142) in TC v7.029.
One would expect the following to create a dataset with 2 columns and rows populated with the data from each tuple, but you get an unexpected result (a 3x2 dataset)
(as opposed to)
The offending lines of code are here:
https://github.com/scicloj/tablecloth/blob/master/src/tablecloth/api/dataset.clj#L75-L79
One possible solution is to just remove this special handling of 2-element iterables and issue a breaking release, another might be to handle the case where a map is given (which seems to be what this is trying to catch, I think?), but not apply the same logic to all 2-element seqs (which would still be a breaking change).
I'd be happy to contribute a PR once a decision is made about if/how to address this issue.
The text was updated successfully, but these errors were encountered: