Skip to content

Commit b485655

Browse files
authored
Merge pull request #10 from jseabold/gh-9
Support notnull/notna. Closes #9.
2 parents 24e899a + 041cb7d commit b485655

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pandas_selectable/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ def isna(self):
177177
def isnull(self):
178178
return self._parent.loc[self._parent.index.isnull()]
179179

180+
@doc(pd.Index.notnull)
181+
def notnull(self):
182+
return self._parent.loc[self._parent.index.notnull()]
183+
184+
@doc(pd.Index.notna)
185+
def notna(self):
186+
return self._parent.loc[self._parent.index.notna()]
187+
180188
@doc(pd.Index.isin)
181189
def isin(self, values, levels=None):
182190
idx = self._parent.index.isin(values, levels)
@@ -196,6 +204,8 @@ class SelectableColumn:
196204
__ge__ = selector_wrapper(pd.Series, "__ge__")
197205
isna = selector_wrapper(pd.Series, "isna")
198206
isnull = selector_wrapper(pd.Series, "isnull")
207+
notna = selector_wrapper(pd.Series, "notna")
208+
notnull = selector_wrapper(pd.Series, "notnull")
199209
isin = selector_wrapper(pd.Series, "isin")
200210

201211
def __init__(self, parent, series=None):

pandas_selectable/tests/test_select.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def test_select(dta):
1919
assert ((dta.select.A != 3).A != 3).all()
2020
assert len(dta.select.A.isnull()) == 0
2121
assert len(dta.select.A.isna()) == 0
22+
assert dta.select.A.notnull().shape == (15, 4)
23+
assert dta.select.A.notna().shape == (15, 4)
2224
assert len(dta.select.A.isin([5])) == 1
2325

2426

@@ -66,6 +68,8 @@ def test_index(dta):
6668

6769
assert len(dta.select.index.isna()) == 0
6870
assert len(dta.select.index.isnull()) == 0
71+
assert dta.select.index.notnull().shape == (15, 4)
72+
assert dta.select.index.notna().shape == (15, 4)
6973
assert len(dta.select.index.isin([10, 11])) == 2
7074

7175

0 commit comments

Comments
 (0)