Skip to content

Commit

Permalink
Add set-index test
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmarazzi committed Jul 10, 2019
1 parent b78566e commit 8d32e5c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/panthera/generics_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[clojure.test :refer :all]
[libpython-clj.python :as py]
[panthera.pandas.generics :as g]
[panthera.pandas.utils :as u]
[panthera.pandas.utils :as u :reload true]
[panthera.pandas.math :as m]))

(deftest series
Expand Down Expand Up @@ -360,3 +360,21 @@
nil
nil
[{0 0 1 1} {0 2 1 3} {0 4 1 5}]))

(deftest set-index
(are [idx m oid ov]
(and (= (vec
(g/index
(g/set-index
(g/data-frame [{:a 1 :b 2 :c 3} {:a 2 :b 3 :c 4}])
idx m)))
oid)
(= (u/->clj
(g/set-index
(g/data-frame [{:a 1 :b 2 :c 3} {:a 2 :b 3 :c 4}])
idx m))
ov))
[:a] {} [1 2] [{:b 2 :c 3} {:b 3 :c 4}]
[:a :b] {} [[1 2] [2 3]] [{:c 3} {:c 4}]
[:a] {:drop false} [1 2] [{:a 1 :b 2 :c 3} {:a 2 :b 3 :c 4}]
[:a] {:append true} [[0 1] [1 2]] [{:b 2 :c 3} {:b 3 :c 4}]))

0 comments on commit 8d32e5c

Please sign in to comment.