Skip to content

Commit

Permalink
Add dropna test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Marazzi committed Jan 14, 2020
1 parent f1fbf56 commit a0d1520
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/panthera/pandas/reshape.clj
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,13 @@
```
"
[df-or-srs & [{:keys [com span halflife min-periods adjust ignore-na axis]
:as attrs}]]
:as attrs}]]
(u/simple-kw-call df-or-srs "ewm" attrs))

; remove :inplace as an attr
(defn dropna
[df-or-srs & [attrs]]
"Drop missing values"
[df-or-srs & [{:keys [axis how thresh subset]
:as attrs}]]
(u/simple-kw-call df-or-srs "dropna" attrs))

(defn melt
Expand Down
26 changes: 26 additions & 0 deletions test/panthera/reshape_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,29 @@
{:b 1.6153846153846152}
{:b 1.6153846153846152}
{:b 3.2249999999999996}]))

(deftest dropna
(are [s o d]
(m/same?
(-> (g/series s)
r/dropna)
(g/series o d))
[] [] {}
[1 nil 2] [1.0 2.0] {:index [0 2]})

(are [att out opt]
(m/same?
(-> (g/data-frame {:name ["Alfred" "Batman" "Robin"]
:toy [nil "Batmobile" "Whip"]
:born [nil "1940-04-25" nil]})
(r/dropna att))
(g/data-frame out opt))
{} [{:name "Batman", :toy "Batmobile", :born "1940-04-25"}] {:index [1]}
{:axis 1} [{:name "Alfred"} {:name "Batman"} {:name "Robin"}] {}
{:how :all} [{:name "Alfred", :toy nil, :born nil}
{:name "Batman", :toy "Batmobile", :born "1940-04-25"}
{:name "Robin", :toy "Whip", :born nil}] {}
{:thresh 2} [{:name "Batman", :toy "Batmobile", :born "1940-04-25"}
{:name "Robin", :toy "Whip", :born nil}] {:index [1 2]}
{:subset [:toy]} [{:name "Batman", :toy "Batmobile", :born "1940-04-25"}
{:name "Robin", :toy "Whip", :born nil}] {:index [1 2]}))

0 comments on commit a0d1520

Please sign in to comment.