diff --git a/src/tablecloth/api/join_separate.clj b/src/tablecloth/api/join_separate.clj index 861aae4..eaf3bdb 100644 --- a/src/tablecloth/api/join_separate.clj +++ b/src/tablecloth/api/join_separate.clj @@ -148,10 +148,10 @@ " ([ds src-column opts] (assert (not (grouped? ds)) "Not supported on grouped datasets") - (let [len-arrays (-> ds src-column first count) + (let [len-arrays (-> ds (get src-column) first count) new-ds (-> - (dtt/concat-buffers (ds src-column)) + (dtt/concat-buffers (get ds src-column)) (tens/reshape [(ds/row-count ds) len-arrays]) (tech.v3.dataset.tensor/tensor->dataset)) diff --git a/test/tablecloth/api/join_separate_test.clj b/test/tablecloth/api/join_separate_test.clj index aa93bf8..8876315 100644 --- a/test/tablecloth/api/join_separate_test.clj +++ b/test/tablecloth/api/join_separate_test.clj @@ -10,7 +10,16 @@ :y [:a :b]}) (api/array-column->columns :x) (api/rows :as-maps)) - => [{:y :a 0 1.0 1 2.0 2 3.0} {:y :b 0 4.0 1 5.0 2 6.0}]) + => [{:y :a 0 1.0 1 2.0 2 3.0} {:y :b 0 4.0 1 5.0 2 6.0}] + + (-> {"a" [[4 4] [3 2] [2 0]]} + api/dataset + (api/array-column->columns "a" { :prefix "c"}) + (api/rows :as-maps) + + ) + => [{"c-0" 4, "c-1" 4} {"c-0" 3, "c-1" 2} {"c-0" 2, "c-1" 0}] + ) (fact "array-column->columns works can prefix columns with key-word" (-> (api/dataset {:x [(double-array [1 2 3])